N
Nathan
How can I detect when one of the arrow keys is pressed?
Thanks,
Nathan
Thanks,
Nathan
Bernie Yaeger said:Hi Nathan,
You can trap them in the keydown event:
Dim xstring As String
xstring = e.KeyCode()
MessageBox.Show(xstring)
The left arrow is 37, right 39, down 40, up 38.
HTH,
Bernie Yaeger
Nathan said:How can I detect when one of the arrow keys is pressed?
* "One Handed Man said:In addition to the others, here is a more elegent snipit.
'A textbox example.
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
Select Case e.KeyCode
Case Keys.Down ' << Note this useful enumeration
MsgBox("DOWN")
Case Keys.Up
MsgBox("UP")
Case Keys.Left
MsgBox("LEFT")
Case Keys.Right
MsgBox("RIGHT")
End Select
End Sub