You can use the Selected property in Visual Basic to determine if an item in a list box is selected.
Setting
The Selected property is a zero-based array that contains the selected state of each item in a list box.
Setting | Description |
---|---|
True (–1) | The list box item is selected. |
False (0) | The list box item isn't selected. |
You can get or set the Selected property by using Visual Basic.
This property is available only at run time.
Remarks
When a list box control's MultiSelect property is set to None, only one item can have its Selected property set to True. When a list box control's MultiSelect property is set to Simple or Extended, any or all of the items can have their Selected property set to True. A multiple-selection list box bound to a field will always have a Value property equal to Null. You use the Selected property or the ItemsSelected collection to retrieve information about which items are selected.
You can use the Selected property to select items in a list box by using Visual Basic. For example, the following expression selects the fifth item in the list:
Me!Listbox.Selected(4) = True