i have a circle and i want to move it all over the form by using arrow buttons. can someone teach me please? thank you
Printable View
i have a circle and i want to move it all over the form by using arrow buttons. can someone teach me please? thank you
Would this work for you?
Code:Option Explicit
Private Sub Form_Load()
Me.KeyPreview = True
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyUp
Shape1.Move Shape1.Left, Shape1.Top - 120
Case vbKeyDown
Shape1.Move Shape1.Left, Shape1.Top + 120
Case vbKeyRight
Shape1.Move Shape1.Left + 120, Shape1.Top
Case vbKeyLeft
Shape1.Move Shape1.Left - 120, Shape1.Top
End Select
End Sub
Thanks thats perfect but can i somehow put it under a timer so its moves smoothly? thx a lot for your help!Quote:
Originally Posted by RhinoBull
Timer? What for? Try changing 120 to some smaller number (30 or so...).
Quote:
Originally Posted by RhinoBull
guess i didnt need a timer..haha great man thanks a lot works PERFECT!!!:)
OK, great!:wave: