You are here: Core Reference > Coding > Scripting > ListBox.Selection

ListBox.Selection

The ListBox Control Object that is returned by the AddListBox function has a Selection property. The Selection property can be used to return the Index Number of currently selected option in the List Box.

Syntax

ControlObject.Selection

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

Returns the Index Number of the option that is currently selected when the Form is closed.

The Selection property can only be used if the Multiple property is disabled (that is False). If the Multiple property is enabled, the IsSelected function can be used for each option to return the Index Numbers of the selected options.

Arguments

None.

Returns

Integer (the Index Number of the option that is selected when the Form is closed).

Example:

MsgBox ListBox.Selection

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)
  • Selection is used to return the Index Number of the currently selected option. The Index Number is shown in the message box that is displayed when this part of the script is executed.

ClearSCADA 2015 R2