5
Contributors
5
Replies
23
Views
5 Years
Discussion Span
Last Post by Sohail_4
1

Set KeyPreview as True on form properties.
Then add this following code :

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'make sure KeyPreview is True on Form Properties
    'On Error Resume Next
    Select Case KeyCode
        Case vbKeyUp
            MsgBox "Up"
        Case vbKeyDown
            MsgBox "Down"
        Case vbKeyLeft
            MsgBox "Left"
        Case vbKeyRight
            MsgBox "Right"
    End Select
End Sub
Votes + Comments
Good
0

Thnk you..!! it worked..!!! i can direct my robot.. using arrow keys..!!!

0

hOW CAN i dO IT when My Focus is not on the Form Like I have hidden and and I want to show it with a key say "K" anybody knows how to do that?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.