Trapping if enter has been type

I

Imran Koradia

If you want to test in a textbox, you could do it this way:

Private Sub TextBox1_KeyDown(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) _
Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
MessageBox.Show("enter!")
End If
End Sub

If you want to test on the entire form, set the form's KeyPreview property
to True and then handle the KeyDown event of the form just as the textbox as
above.

hope that helps..
Imran.
 
C

Chris Calhoun

For some reason my application will not recognize the enter key as a keydown
event what gives???

I just want to test if the enter key has been struct in a textbox any
suggestions?

Thanks in Advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top