VSFlexGrid Control > VSFlexGrid Properties, Events, and Methods > VSFlexGrid Properties > SelectedRows Property |
Returns the number of selected rows when SelectionMode is set to flexSelectionListBox.
val& = [form!]VSFlexGrid.SelectedRows
This property works in conjunction with the SelectedRow 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.
The code below prints the number of selected rows to the debug window when the selection changes:
Private Sub Form_Load()
fg.SelectionMode = flexSelectionListBox
End Sub
Private Sub fg_SelChange()
Debug.Print fg.SelectedRows
End Sub
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 an example, see the SelectedRows property.
Long