Create a Form.
Place a Command Button and Timer control.
Place the code in the timer control and Run it.
The command button will be dancing
Private Sub Timer1_Timer()
Static i As Single
If i > 4 Then i = 0
Select Case i
Case 1:
Command1.Left = Command1.Left + 30
Case 2:
Command1.Top = Command1.Top + 30
Case 3:
Command1.Left = Command1.Left - 30
Case 4:
Command1.Top = Command1.Top - 30
End Select
i = i + 1
End Sub
Comments