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
 

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

Similar Threads

Whole Numbers 4
Hard drive number 1
Diplay a label box 2
BackColor 2
Running exe 4
Insert key press in text box 3
Print 1
Textbox return key event 3

Back
Top