Home All Groups Group Topic Archive Search About

register Mouse wheel handler in main VB .net 2005 form

Author
11 May 2006 6:03 PM
ingmar
Hi,

how do I register my Mouse wheel handler in my main VB .net 2005 form?
My function

  Private Sub Me_MouseWheel(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles Me.MouseWheel

never gets called. What do I need to do to tell VB that this function
should handle the mouse wheel event?

In the designer, on the events list I do not have a MouseWheel event,
only MouseUp, MouseDown, MouseEnter, MouseLeave, MouseHover, MouseMove.
If I could get MouseWheel into this my problems are most likely
resolved.

Thanks for any help

Ingmar

Author
11 May 2006 6:09 PM
ingmar
I just read to a number of related posts.
The best I could find was to add a function like:

Protected Overrides Sub OnMouseWheel(ByVal e As
System.Windows.Forms.MouseEventArgs)
    Me_MouseWheel(Me, e)
  End Sub

However, this also seems to never get called :-(
Author
11 May 2006 10:07 PM
Herfried K. Wagner [MVP]
"ingmar" <ingmar.bit***@gmail.com> schrieb:
> how do I register my Mouse wheel handler in my main VB .net 2005 form?
> My function
>
>  Private Sub Me_MouseWheel(ByVal sender As Object, ByVal e As
> System.Windows.Forms.MouseEventArgs) Handles Me.MouseWheel
>
> never gets called.

Replace 'Me.MouseWheel' with 'MyBase.MouseWheel' or alternatively override
the form's 'OnMouseWheel' method.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>