How can i make the arrow keys "click" a command button? example, left arrow key is next, right arrow key is back?
Printable View
How can i make the arrow keys "click" a command button? example, left arrow key is next, right arrow key is back?
on the keypress use somethinglike this
cmdNext_click
You'll have to research to get the exact syntax, but
In the KeyDown event of the Form, you'll get a KeyCode passed to you. You can then test something like this:
vb Code:
Select Case KeyCode Case vbKeyLeft Call cmdBack_Click Case vbKeyRight Call cmdNext_Click ' etc. End Select
Call cmdNext_click
Edit:The above response is much better, use that one.
Just be sure that there's no text box or any other object stealing the focus. Bear in mind, a command button CAN be selected without being clicked, so if CmdBack has focus, a test in Form_KeyPress won't trigger anything.