KB-46571: Selecting multiple items in a ListBox.

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.

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *