BeforeScroll Event

Fired before the control scrolls.

Syntax

Private Sub VSFlexGrid_BeforeScroll( ByVal OldTopRow As Long,  ByVal OldLeftCol As Long,  ByVal NewTopRow As Long,  ByVal NewLeftCol As Long, Cancel As Boolean)

Remarks

This event allows you to prevent the user from scrolling the grid while an operation is being performed on the current selection.

For example, the code below prevents the user from scrolling the grid vertically while a cell is being edited (it allows horizontal scrolling):

    Private Sub fg_BeforeScroll(ByVal OldTopRow As Long, ByVal OldLeftCol As Long, _

                                ByVal NewTopRow As Long, ByVal NewLeftCol As Long, Cancel As Boolean)

        If fg.EditWindow <> 0 And OldTopRow <> NewTopRow Then Cancel = True

    End Sub

See Also

VSFlexGrid Control