Even though mfroeb told me to type:
--
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyLeft Then
Paddle.Left = Paddle.Left - 75
End If
If KeyAscii = vbKeyRight Then
Paddle.Left = Paddle.Left + 75
End If
End Sub
--
YA SO I HAVE NO IDEA WHAT TO DO NOW. THIS SHOULD MAKE THE PADDLE GO LEFT OR RIGHT DEPENDING ON WHICH BUTTON YOU PUSH.
Comments
: --
: Private Sub Form_KeyPress(KeyAscii As Integer)
: If KeyAscii = vbKeyLeft Then
: Paddle.Left = Paddle.Left - 75
: End If
: If KeyAscii = vbKeyRight Then
: Paddle.Left = Paddle.Left + 75
: End If
: End Sub
: --
: YA SO I HAVE NO IDEA WHAT TO DO NOW. THIS SHOULD MAKE THE PADDLE GO LEFT OR RIGHT DEPENDING ON WHICH BUTTON YOU PUSH.
:
Not sure what's your problem. That code did not work? What is Paddle? In my example it's Command button.
First of all, set Form KeyPreview property to true. Do not use Key_press event. Instaed use Key_Down. Then write code like that and try it
[code]Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 39 Then
Paddle.Left = Paddle.Left - 75
End If
If KeyCode = 37 Then
Paddle.Left = Paddle.Left + 75
End If
End Sub[/code]