Detecting Enter keypress on VB.NET

前端 未结 15 1301
后悔当初
后悔当初 2020-12-05 04:56

I am using .NET 3.5 framework of VB.NET 2008.

I have some textboxes in my form. I want the tab-like behavior when my user presses ENTER on one of my textboxes. I use

15条回答
  •  无人及你
    2020-12-05 05:12

    use this code this might help you to get tab like behaviour when user presses enter

     Private Sub TxtSearch_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles TxtSearch.KeyPress
        Try
            If e.KeyChar = Convert.ToChar(13) Then
               nexttextbox.setfoucus 
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
    

提交回复
热议问题