I have a Panel
that has AutoScroll = true
.
In that Panel
is a series of TextBox
es. I should note that the TextBox
es aren't on the panel
directly but are nested several levels (about 4-5).
Now, the scrolling with my mouse wheel works only if the panel has focus, naturally. I can use Focus()
within mouseEnter
event to make sure the panel has focus.
However, the TextBox
es I mentioned earlier rely heavily on focus. Only the user should be able to remove focus from the TextBox
by clicking somewhere else.
The TextBox
es are created dynamically and would make for a very messy code to keep an array of them, or any type of reference to check if they have focus. Not to mention that there could be a lot of them.
How do I give the focus to the Panel
, but only if none of the TextBox
es is focused?