I know how to set the tab order on the forms on VB.net. but i want to set such that when i press enter while on the form, the cursor will go to the next textbox based on the tab order set.

Recommended Answers

hello !
Yes,there is a way.

Set KeyPreview property of your Form to True.
And use this code for your Form_KeyDown event:

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
        If e.KeyCode = Keys.Return Then
            SendKeys.Send("{TAB}")
        End If
    End Sub

hope this …

Jump to Post

All 3 Replies

hello !
Yes,there is a way.

Set KeyPreview property of your Form to True.
And use this code for your Form_KeyDown event:

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
        If e.KeyCode = Keys.Return Then
            SendKeys.Send("{TAB}")
        End If
    End Sub

hope this helps you.

Regards

thanx a lot!! it works...

you wc :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.