Use this :
Private Sub textbox1_KeyDown(ByVal sender As Object, ByVal e As System..Windows.Forms.KeyEventArgs) Handles textbox1.KeyDown
if e.KeyCode = Keys.Return Then
----- Process to Insert value
sendkeys.send("{TAB}")
End sub
Try this
I've use the following so that users can use either the enter or the
tab key to move to the next control. Just make sure that your controls
are properly ordered via the tabindex property.
' GOT THIS FROM THE NET. NOT SURE WHERE.
<DllImport("user32.dll", CallingConvention:=CallingConvention.StdCall,
_
CharSet:=CharSet.Unicode, EntryPoint:="keybd_event", _
ExactSpelling:=True, SetLastError:=True)> _
Public Sub keybd_event(ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Integer, ByVal
dwExtraInfo As Integer)
End Sub
Public Sub FakeTab()
keybd_event(9, 143, 0, 0) '; // Tab Press
End Sub
Your form's KeyPreview property should be set to True, Then in your
form's keydown event:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Enter Then
FakeTab()
End If
End Sub
hth