VSFlexGrid Control > VSFlexGrid Properties, Events, and Methods > VSFlexGrid Properties > SelectedRow Property |
Returns the position of a selected row when SelectionMode is set to flexSelectionListBox.
[form!]VSFlexGrid.SelectedRow(Index As Long)[ = value As Long ]
This property works in conjunction with the SelectedRows property to enumerate all selected rows in the control. These properties are especially useful when the SelectionMode property is set to flexSelectionListBox (3), which allows the user to select multiple, non-adjacent rows.
Using the SelectedRows and SelectedRow properties to enumerate all selected rows is equivalent to, but faster than scanning the entire control for selected rows by reading the IsSelected property.
For example,
For i = 0 to fg.SelectedRows – 1
Debug.Print "Row "; fg.SelectedRow(i); " is selected"
Next
is faster than
For i = 0 to fg.Rows
If fg.IsSelected(i) Then Debug.Print "Row "; i; " is selected"
Next
Long