|
How do I link arrow keys to code in VB.NET?
Hello there
I'm trying to write code that responds to the user manipulating two of the arrow keys (you know, the four keys just under the delete, end and page down keys). The following code compiles okay but it doesn't do anything. I just wondered how I should modify it. All contributions gratefully accepted.
meandmymachine
Heres the code:
Dim vbKeyRight As Integer
Dim vbKeyLeft As Integer
Private Sub KeyPress1_KeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer)
If KeyCode = vbKeyRight Then
MsgBox("Right Key Pressed!")
End If
End Sub
Private Sub KeyPress2_KeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer)
If KeyCode = vbKeyLeft Then
MsgBox("Left Key Pressed!")
End If
End Sub
|