|
-
Oct 20th, 2010, 06:41 AM
#1
Thread Starter
New Member
How can i detect what key has been pressed on a form that has command buttons on it?
How can i detect what key has been pressed on a form that has command
buttons on it? I know that using the Form_KeyDown event with the
Form.KeyPreview property et to True works when there are no buttons on
the form, but i have buttons on the form and when i try to detect
events like pressing the arrow keys, the program doe...s not respond to
the events but instead just shifts focus from button to button using
the arrow keys.
When the focus is on the command button it detects most of the keyboard inputs except for the arrow keys. Help me, please!!
Link:
http://www.mediafire.com/file/47jfve...entKeyDown.rar
src:
Private Sub Command1_KeyDown(KeyCode As Integer, Shift As Integer)
'SendKeys (vbKeyShift)
If KeyCode = 40 Then
MsgBox ("Key DOWN")
End If
If KeyCode = 38 Then
MsgBox ("Key UP")
End If
End Sub
Private Sub Form_Load()
KeyPreview = True
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|