How to make Enter on a TextBox act as TAB button

后端 未结 12 2672
迷失自我
迷失自我 2020-12-25 13:10

I\'ve several textboxes. I would like to make the Enter button act as Tab. So that when I will be in one textbox, pressing Enter will move me to the next one. Could you plea

12条回答
  •  无人及你
    2020-12-25 14:14

    If you define Tab Order of all controls and make Form.KeyPreview = True, only need this:

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

提交回复
热议问题