954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How do I override default mouse wheel settings

I have a NumericUpDown control that I want to allow the user to change with the mouse scroll wheel. The problem is that even with the following code

Private Sub numSeries_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles numSeries.MouseWheel
    If e.Delta > 0 Then
        numSeries.Value += 1
    Else
        If numSeries.Value > 0 Then
            numSeries.Value -= 1
        End If
    End If
End Sub

The value in the control changes based on Windows mouse settings. Specifically, my mouse is set (in Control Panel) to scroll two lines with each wheel "tic". The above code therefore changes my value by +3 or -3 because (apparently) the event is being handled at two different levels. Is there some way to tell VB that I want to handle this event all by myself and ignore the default action?

Reverend Jim
Posting Shark
Moderator
1,169 posts since Aug 2010
Reputation Points: 253
Solved Threads: 159
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: