VSFlexGrid Control > VSFlexGrid Properties, Events, and Methods > VSFlexGrid Events > BeforeMoveColumn Event |
Fired before a column is moved by dragging on the ExplorerBar.
Private Sub VSFlexGrid_BeforeMoveColumn( ByVal Col As Long, Position As Long)
This event is only fired if the column was moved by dragging it into the ExplorerBar. It is not fired after before moving with the ColPosition property.
This event is useful when you want to prevent the user from moving certain columns to invalid positions. You may do so by modifying the value of the Position parameter.
For example, the following code prevents Column 1 from being moved to another position and other columns from being moved to its position:
Private Sub VSFlexGrid1_BeforeMoveColumn(ByVal Col As Long, Position As Long)
If Col = 1 Then Position = 1
If Col <> 1 And Position = 1 Then Position = Col
End Sub