MouseWheel event

larshgf

New member
Local time
Today, 22:24
Joined
Dec 21, 2009
Messages
9
Hi,
I want to be able to scroll text in an unbound TextBox using the Scroll Wheel on the mouse.
If I create this event-handler the Scroll Wheel will make the courser go down and in this way indirectly scroll the text in the TextBox:

Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
SendKeys "{DOWN 2}"
End Sub

I would like to know how Access figure out which way I roll the Scroll Wheel. Then I could write something like

Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
if "wheel is turned one way then"
SendKeys "{DOWN 2}"
else
if "wheel is turned the other way then"
SendKeys "{UP 2}"
End if
End Sub

I wonder if "ByVal" or "Page" has something to do with it? Can somebody deliver a piece of code that really does the trick?

Best Regards
Lars
 
I have been working with this problem and found a solution for scrolling down and up is like this:

Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)

If Screen.ActiveControl.Name = "name of your TextBox here" Then
If Count > 0 Then
SendKeys "{DOWN 2}"
ElseIf Count < 0 Then
SendKeys "{UP 2}"
End If
Keys "{DOWN 2}"
End If

End Sub

BR
Lars
 

Users who are viewing this thread

Back
Top Bottom