I am using .NET 3.5 framework of VB.NET 2008.
I have some textboxes in my form. I want the tab-like behavior when my user presses ENTER on one of my textboxes. I use
I have test this code on Visual Studio 2019
Its working superb
Just Paste it into you form code
it will work on all textboxs on same form
Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
Dim keyCode As Keys = CType(msg.WParam, IntPtr).ToInt32
Const WM_KEYDOWN As Integer = &H100
If msg.Msg = WM_KEYDOWN AndAlso keyCode = Keys.Enter _
AndAlso Me.ActiveControl.GetType.Name = "TextBox" Then
Me.SelectNextControl(Me.ActiveControl, True, True, False, True)
Return True
End If
Return MyBase.ProcessCmdKey(msg, keyData)
End Function