ZaZZ ZaZZ - 1 year ago 97 Question

Preventing a textbox from capturing the MouseWheel event

I have a

and when I scroll down my form with the mouse wheel and hit the textbox with the mouse, it stops scrolling.

Is there a way to avoid that ?

Answer Source

OK, If I understand you correctly, what you are searching is to keep mouse wheeling while passing on your TextBox. Is that correct ?

There is, I think, a way to achieve that. This code however has not been tested, so keep me informed if it worked.

Public Sub New()
    'Other inits here
    AddHandler TextBox1.MouseWheel, AddressOf TBMouseWheel
End Sub

Private Sub TBMouseWheel(sender As Object, e As MouseEventArgs)
End Sub

This way, when your textbox captures a MouseWheel event, it is passed on the form, which will handle it (I think). Sorry I don't have the opportunity to test it right now, but I believe this should do the trick.