Object Reference > True DBGrid Events > SelChange Event |
SelChange Event
The SelChange event occurs when the user selects a different range of rows or columns.
object_SelChange (Cancel As Integer)
Arguments
Cancel is an integer that may be set to True to undo the new selection.
This event is triggered under several circumstances:
· When the user selects a single row by clicking its record selector.
· When the user adds a row to the list of selected rows by clicking its record selector while holding down the Ctrl key.
· When the user selects a single column by clicking its header.
· When the user changes the range of selected columns by dragging to an adjacent column within the header row.
· When the user extends the range of selected columns by holding down the Shift key and clicking an unselected column header.
· When the user clears the current row or column selection by clicking an individual cell, in which case this event precedes RowColChange.
The current range of selected columns is provided by the SelStartCol and SelEndCol properties. The bookmarks of the selected rows are available in the SelBookmarks collection. Within this event procedure, these properties and collections reflect the user's pending selection(s).
If your event procedure sets the Cancel argument to True, the previous row and column selections (if any) are restored, and the aforementioned properties revert to their previous values.
This event is only triggered by user interaction with the grid. It cannot be triggered by code.
Note
When the user selects a column, any row selections are cleared. Similarly, when the user selects a row, any column selections are cleared.