How can I stop shape after 5 seconds of moving?

I know how to move it and how to stop it but don't know how to make it stop IN 5 SECONDS.
This is the rest of the code that I have done but the 5 seconds part is still left. BTW, I tried to use loop but it didn't work out.
Thanks everyone in advance. :)

Private Sub Command1_Click()
Timer1.Enabled = True
End Sub

Private Sub Form_Load()
Command1.Caption = "Move"
End Sub

Private Sub Timer1_Timer()
Shape1.Left = Shape1.Left + 50
End Sub

i could be wrong,
the timers interval is in miliseconds. set it to 1,000
and set the timer disabled.

private x as integer
 
private sub form_load()
x% = 1
end sub
 
private sub command1_click()
timer1.enabled = true
end sub
 
private sub timer1_timer
shape1.left = shape1.left + 50
x% = x% + 1
if x% = 5 then timer1.enabled = false
end sub

the interval might not be 1,000.
im not sure, basically you would just want the timer to fire off every second, everytime it does x increments by 1 until it reaches 5 and the timer shuts off.

Thank you so much. I didn't realize that it was so simple. I thought I needed a loop or something.

no problem

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.