Possible Duplicate:
Panel not getting focus
I have a slightly annoying situation.
I have a WinForm with a PictureBox
held within a Panel
(so I can make the picture scrollable if it exceeds a certain size constraint my form has).
Now, in order to enable the user to be able to scroll in the panel using the MouseWheel, I had to put in the following code:
Private Sub MyPanel_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyPanel.MouseEnter
MyPanel.Focus()
End Sub
This works great and allows the user to scroll the picture as I would like.
Now, my problem is that I also have a textbox
on my form which I would like the user to be able to fill data into.
The challenge comes about when the user clicks in the textbox and moves the mouse over the Panel - This takes control away from the textbox and stops the user from being able to type.
How can I handle this situation best??