Thanks for the suggestion. This exposed a genuine gap in the ListBox API. I’ve implemented programmatic multi-selection for the next Objo Studio release, using slightly more explicit row-based names:
ListBox1.SelectionMode = "Multiple"
ListBox1.SelectRow(1)
ListBox1.SelectRow(3, True)
ListBox1.SelectRow(5, True)
Var selectedRows As Array(Of Integer) = ListBox1.SelectedRowIndexes
SelectRow(index) replaces the current selection. Passing True as the second argument adds the row to the existing selection:
ListBox1.SelectRow(3, True)
You can also deselect an individual row:
ListBox1.DeselectRow(3)
SelectedRowIndexes returns all selected row indexes in display order. The existing SelectedRowCount and SelectedRowIndex(n) APIs remain available for compatibility.
Invalid indexes, selecting an already-selected row, and deselecting an unselected row are harmless no-ops and do not fire SelectionChanged.
https://feedback.objo.dev/feature/1180