|
-
Nov 2nd, 1999, 01:54 AM
#1
Thread Starter
New Member
I need to know when an arrow key has been pressed but I can't locate the code to use for trapping them.
-
Nov 2nd, 1999, 02:01 AM
#2
If you want to know if an arrow key is pressed for one control, you can use the KeyDown event of the specific control. If you want to know this for the complete form, set the KeyPreview Property of the form to True and use the form's KeyDown event. The KeyCode paramter tells you which key has been pressed.
Left arrow : KeyCode = 37
Up arrow : KeyCode = 38
Right arrow : KeyCode = 39
Down arrow : KeyCode = 40
-
Nov 2nd, 1999, 02:09 AM
#3
Rather than use hard-coded "magic numbers" like 37, 38, etc., use the built-in vbKey... constants instead. For example vbKeyLeft has a value of 37.
------------------
Marty
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
|