Page 1 of 1

Creating a pause...

Posted: Wed Nov 02, 2005 4:49 pm
by MasterChief2829
Hey, I was wondering how you make it like pause. I know how to make it so a message pops up of course thats basic... but can you make it like pause a few seconds before the message pops up? Like time it? Thanks.

Posted: Wed Nov 02, 2005 6:01 pm
by Onetoomanysodas
Yea, at the end of the code where you want it to pause write something like this:

Code: Select all

Command1_click()
Timer1.Interval = 3000 '(This is 3 seconds because its in milliseconds)
End Sub
Make sure to create a timer and put this code in the timer:

Code: Select all

Timer1_Timer()
Msgbox "3 seconds have passed"
Timer1.interval = 0
End Sub
The reason you set the interval to 3000 and then back to 0 is because when a timer's interval is set to 0 it is the same as being disabled. This also allows you to press the command button more than once. This also works with the timer.enabled property but then you have to set the timer to be disabled on startup rather than its default enabled.

Posted: Tue Nov 08, 2005 7:34 pm
by MasterChief2829
I'm using Visual C#... isnt that Visual Basic,...

Posted: Wed Nov 09, 2005 12:13 pm
by Patrickssj6
Yeah that was vb

Posted: Wed Nov 09, 2005 1:30 pm
by MasterChief2829
ahh well I can use VB too :P Thanks.

Posted: Wed Nov 09, 2005 5:44 pm
by superaison
Onetoomanysodas wrote:Yea, at the end of the code where you want it to pause write something like this:

Code: Select all

Command1_click()
Timer1.Interval = 3000 '(This is 3 seconds because its in milliseconds)
End Sub
Make sure to create a timer and put this code in the timer:

Code: Select all

Timer1_Timer()
Msgbox "3 seconds have passed"
Timer1.interval = 0
End Sub
The reason you set the interval to 3000 and then back to 0 is because when a timer's interval is set to 0 it is the same as being disabled. This also allows you to press the command button more than once. This also works with the timer.enabled property but then you have to set the timer to be disabled on startup rather than its default enabled.

um that just made like the app crash

Posted: Wed Nov 09, 2005 7:24 pm
by Onetoomanysodas
Uhm, this is vb 6 you noob