Question:
Can multiple items be selected at the same time in a ListBox?
Solution:
Yes. To do so, use ListBox’s Selected property and create a script that scrolls the items in the object and tests which are selected. ListBox’s MultiSelect property’s value must be either 1-fmMultiSelectMulti or 2-fmMultiSelectExtended.
Below is a sample script executed in Click() event of a button on the same screen as a four-item ListBox:
Dim Values(4)
FOR i = 0 TO 3
IF Screen.Item(“ListBox1”).Selected(i) THEN
Values(i) = Screen.Item(“ListBox1”).List(i)
END IF
NEXT
MsgBox Values(0) & vbNewLine & Values(1) & vbNewLine & Values(2) & vbNewLine& Values(3)
Note: The script’s FOR command must contemplate all items added to the ListBox.