i want to design a software for a robot. i want to use the arrow keys of keyboard to direct the robot. can any one tell me that how can i do coding of that?

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
commented: Good +0

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

How do you declare the up, down, left and right keys?

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?