Key Pressed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hey guys, i have a quick questions

how do i find out if the key pressed is the "ENTER" Key from a text box ??

NEED THE CODE PLEAS

Thanx in advance
 
try this

Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Select Case e.KeyChar
Case ControlChars.CrLf
MessageBox.Show("You pressed ENTER !")
End Select
End Sub

KS, Denmark
 
Hi,

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 pressed")

End If

End Sub



Ken
 
Back
Top