0

I am currently working on a project in VB.NET and I have a fixed-border form with the AutoScroll property set to True. Under the Load event, I have some loops that add a bunch of controls to the form, so I have AutoScroll create the scrollbar for me automatically.

Now when I open up this form, all the controls load up with no problem, it focuses on my first text box, and the scroll bar shows up. However, the mouse wheel does not do anything whatsoever.

So my question is, how do I, no matter where my focus or mouse is, scroll with the AutoScroll property enabled, in VB.NET?

Chris Morris
  • 107
  • 2
  • 3
  • 6
  • MouseWheel only works on the active control, which is your TextBox, and TextBoxes can scroll. See [How to capture mouse wheel on panel?](http://stackoverflow.com/q/4429901/719186) – LarsTech Mar 26 '14 at 18:32
  • @LarsTech okay, and just to clarify, I have scroll bars in my text boxes that are there for scrolling the text. They work just fine with the mouse, which is strange to me. By "TextBoxes can scroll," do you mean that the user can scroll within the text box, or that I can control the form's scrolling while the focus is on a text box? – Chris Morris Mar 26 '14 at 19:52
  • Are you expecting the TextBoxes and the host Panel to both scroll with the mouse wheel at the same time? That's not the default behavior. WinForms gives the precedence to the active control, which is the TextBox. – LarsTech Mar 26 '14 at 21:03

1 Answers1

0

as far as i know, scrolling is only enabled when focusing the appropriate element. but should be able to trigger scrolling by catching onmouseover() or similar...

this is somthing similar (just for a datagrid) scrolling datagridview without get focus

Community
  • 1
  • 1
Resu
  • 61
  • 9