TotalSelected PowerScript function
Description
Determines the number of items in a ListBox control that are
selected.
Controls
ListBox, PictureListBox, and ListView controls
Syntax
|
1 |
<span>listcontrolname</span>.<span>TotalSelected</span> ( ) |
|
Argument |
Description |
|---|---|
|
listcontrolname |
The name of the ListBox, PictureListBox, |
Return Values
Integer. Returns the number of items
in listcontrolname that are selected. If no items
in listcontrolname are selected, TotalSelected returns
0. If an error occurs, it returns -1. If listcontrolname is null, TotalSelected returns null.
Usage
TotalSelected works only if the MultiSelect
property of listcontrolname is TRUE.
Examples
If three items are selected in lb_Actions,
this example sets SelectedTotal to 3:
|
1 |
integer SelectedTotal |
|
1 |
SelectedTotal = lb_Actions.<span>TotalSelected</span>() |
These statements in the SelectionChanged event of lb_Actions display
a MessageBox if the user tries to select more than three items:
|
1 |
IF lb_Actions.<span>TotalSelected</span>() > 3 THEN |
|
1 |
MessageBox("Warning", & |
|
1 |
"You can only select 3 items!") |
|
1 |
ELSE |
|
1 |
... // Some processing |
|
1 |
END IF |