Re: Trapping if enter has been type by Imran
Imran
Tue Oct 19 14:12:27 CDT 2004
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.
"Chris Calhoun" <calhoun_chris@hotmail.com> wrote in message
news:%23g61$wgtEHA.3016@TK2MSFTNGP12.phx.gbl...
> 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.
>
>