From Xojo Documentation
Gets or sets the selection status of the passed Row. Row is zero-based.
Selected is True if the row passed is selected. This property can be used to determine if the row is selected and to select the row. For example,
Select Multiple Rows
In order to select multiple row, the SelectionType must be set to Multiple. This code selects only the even-numbered rows:
For i As Integer = 0 To ListBox1.ListCount - 1
If i Mod 2 = 0 Then
ListBox1.Selected(i) = True
Getting the list of selected rows
If you allow the ListBox to have multiple items selected (see SelectionType), you may want to establish a list of all the rows selected. The following example shows how to achieve that. The ListBox is named ListBox1.