Hi Rogelio,
Thanks for your help.
Rogelio wrote:
Protected Overrides Sub OnEnter(ByVal e As System.EventArgs)
If Me._readOnly Then
Me.FocusNextControl()
Else
MyBase.OnEnter(e)
End If
End Sub
Then I set myusercontrol's NextControl property in the load event of the form where I use myusercontrol.
If I add OnEnter event for usercontrol, it does not get fired sometimes, due to focus is not moving to next UserControl (user needs to press Tab key twice to move focus???).
As it doesn't fire the focus event, your code does not work. Also, you might notice that form creates dynamic controls, so it might be difficult to track NextControl property in my complex usercontrol.
Private Sub PanelEditor_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Enter
Debug.WriteLine("PanelEditor_Enter")
End Sub
To make Tab key work properly, If I change
Inherits System.Windows.Forms.UserControl
to
Inherits System.Windows.Forms.Panel
It works!!! but it's not a correct way, it does not have couple of events (Load) and nice designer.
Any other ideas/suggestion?
Kind Regards.
Developer