DesktopListBoxRow.Selected

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Read-Only Property (As Boolean )
BooleanValue = aDesktopListBoxRow.Selected

New in 2021r3

Supported for all project types and targets.

Gets the selection status of the current row.

Notes

Selected is True if the row passed is selected. This property can be used to determine if the row is selected. For example,

Var rowsSelected As Integer
For Each row As ListBoxRow In ListBox.Rows
If row.Selected Then rowsSelected = rowsSelected + 1
Next

Examples

Getting the list of selected rows

If you allow the DesktopListBox to have multiple items selected (see RowSelectionType), you may want to establish a list of all the rows selected. The following example shows how to achieve that. The DesktopListBox is named ListBox1.

Var selectedRows() As DesktopListBoxRow // Will hold the selected rows

For Each row As ListBoxRow In ListBox1.Rows
If row.Selected Then
selectedRows.AddRow(row)
End If
Next