Anyone know how to make the return key used in a text box trigger an event?

Recommended Answers

All 3 Replies

Private Sub TextBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp
        If e.KeyCode = Keys.Return Then
            keyPressed()
        End If
    End Sub

    Sub keyPressed()
        MsgBox("Enter key Pressed.")
    End Sub

Nice One,

Thanx for the help!

Be a part of the DaniWeb community

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