Creating a pause...
- MasterChief2829
- Posts: 1184
- Joined: Sun Dec 26, 2004 2:18 pm
![]() |
![]() |
Creating a pause...
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.
-
- Posts: 325
- Joined: Mon Mar 22, 2004 3:59 pm
- Location: Everywhere but nowhere
- Contact:
Yea, at the end of the code where you want it to pause write something like this:
Make sure to create a timer and put this code in the timer:
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.
Code: Select all
Command1_click()
Timer1.Interval = 3000 '(This is 3 seconds because its in milliseconds)
End Sub
Code: Select all
Timer1_Timer()
Msgbox "3 seconds have passed"
Timer1.interval = 0
End Sub
- MasterChief2829
- Posts: 1184
- Joined: Sun Dec 26, 2004 2:18 pm
![]() |
![]() |
-
- Posts: 5426
- Joined: Sat Jul 24, 2004 12:12 pm
- Location: I'm a Paranoid
- Contact:
![]() |
![]() |
-
- Posts: 175
- Joined: Mon Jul 25, 2005 5:06 pm
Onetoomanysodas wrote:Yea, at the end of the code where you want it to pause write something like this:Make sure to create a timer and put this code in the timer:Code: Select all
Command1_click() Timer1.Interval = 3000 '(This is 3 seconds because its in milliseconds) 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.Code: Select all
Timer1_Timer() Msgbox "3 seconds have passed" Timer1.interval = 0 End Sub
um that just made like the app crash
-
- Posts: 325
- Joined: Mon Mar 22, 2004 3:59 pm
- Location: Everywhere but nowhere
- Contact: