Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set focus after user hits enter

Status
Not open for further replies.

wandan

Technical User
Dec 16, 2001
101
US
Hello,

Is there an easy way for VB.Net to set the focus to a specific control once a user enters a value and hits the Enter key?

Thanks.
 
Here's an example:
Code:
    Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
        If e.KeyCode = Keys.Enter Then
            TextBox2.Focus()
        End If
    End Sub
 
EXCELLENT!!! That worked perfectly!! Thanks so much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top