ListBox.Sort
The ListBox Control Object that is returned by the AddListBox function has a Sort property. The Sort property allows you to sort the List Box options into alphabetical order.
Syntax |
ControlObject.Sort = Value Where ControlObject. is the name of the variable (declared in your script) that is used to store the List Box Control Object that is returned by the AddListBox function. |
Description |
Re-orders the Check Box options into alphabetical order. If the options are not reordered alphabetically, they are ordered according to when they were added or the positions in which they were inserted (by the ListBox.Add and ListBox.Insert functions respectively). If the options are ordered alphabetically, the order in which the options were added and the positions in which they were inserted has no bearing on the order in the list—the list will be sorted by name in alphabetical order. |
Arguments |
Value {Boolean} If set to True (1), options are sorted in alphabetical order; if set to False (0), the options are not sorted in alphabetical order (they are sorted according to the order in which they were added or in the positions in which they were inserted). |
Returns |
Boolean |
Example:
A Form has a List Box with 8 options. The options were added by using the ListBox.Add function, and they were added in this order:
- Drainage (added first)
- None (added second)
- All Areas (added third)
- Corridor 16 (added fourth)
- Corridor 11 (added fifth)
- Boiler Room (added sixth)
- Air Control (added seventh)
- Canteen (added last)
The following script is used to set the options to be sorted alphabetically:
ListBox.Sort = True
Where:
- ListBox is the name of the variable used to store the List Box Control Object that is returned by the AddListBox function (which would be defined earlier in the script)
- Sort = True sets the List Box to be sorted in alphabetical order.