How to convert multiple event into one for all textboxes in vb.net
  • Private Sub TextBox_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles TextBox1.KeyDown, TextBox2.KeyDown, TextBox3.KeyDown, TextBox4.KeyDown

    If e.KeyCode = Keys.Enter And Me.TextBox1.Focused Then
    MessageBox.Show("TextBox 1 Enter")
    ElseIf e.KeyCode = Keys.Enter And Me.TextBox2.Focused Then
    MessageBox.Show("TextBox 2 Enter")
    ElseIf e.KeyCode = Keys.Enter And Me.TextBox3.Focused Then
    MessageBox.Show("TextBox 3 Enter")
    ElseIf e.KeyCode = Keys.Enter And Me.TextBox4.Focused Then
    MessageBox.Show("TextBox 4 Enter")

    ElseIf Me.TextBox5.Focused Then
    If (e.KeyCode.Equals(Keys.Tab)) Then
    TextBox6.Focus()
    End If
    ElseIf Me.TextBox6.Focused Then
    If (e.KeyCode.Equals(Keys.Tab)) Then
    TextBox7.Focus()
    End If
    ElseIf Me.TextBox7.Focused Then
    If (e.KeyCode.Equals(Keys.Tab)) Then
    TextBox1.Focus()
    End If

    End If
    End Sub
    for further details and related topics http://www.codecorner.somee.com/

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week

Top Posters Weekly

Optimum Creative