ListBoxRow.Selected

From Xojo Documentation

Revision as of 15:49, 18 December 2019 by Gperlman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

New in 2019r3

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 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.

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

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