Link to home
Start Free TrialLog in
Avatar of JEGB
JEGB

asked on

Detecting Which ScrollBar In a VSFlexGrid

Within a VSFlexGrid there is a Scroll Event which is fired whenever the user uses either the vertical or the horizontal.  I want to be able to tell which one it is since I want to execute some code only when the vertical scroll bar is used.  There is no parameter in the event itself and I can't seem to locate any properties.  Has anyone done/know how to do this?
Avatar of TimCottee
TimCottee
Flag of United Kingdom of Great Britain and Northern Ireland image

You should be able to use the .TopRow and .LeftCol properties to determine which way the scroll event has occurred.

If you store the initial values of these on the form_load or other populate.

intLeftCol = Grid.LeftCol
intTopRow = Grid.TopRow

In the Scroll event you can check:

Sub Grid_Scroll()
  IF intLeftCol <> Grid.LeftCol Then
    'Code for horiz scroll
    intLeftCol = Grid.LeftCol
    'Set for next scroll
  End If
  If intTopRow <> Grid.TopRow Then
    'Code for vertical scroll
    intTopRow = Grid.TopRow
    'Set for next scroll
  End If
End Sub
ASKER CERTIFIED SOLUTION
Avatar of TimCottee
TimCottee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JEGB
JEGB

ASKER

Ta Tim, forgot to accept your answer, many thanks.