Trapping if enter has been type

  • Thread starter Thread starter Imran Koradia
  • Start date Start date
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.
 
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.
 
Back
Top