-
Apr 22nd, 2006, 05:42 AM
#1
Thread Starter
Hyperactive Member
Display message with a delay?
Hi, everyone.
My question is:
How to display a message with a delay?
Thanks.
-
Apr 22nd, 2006, 06:13 AM
#2
Thread Starter
Hyperactive Member
Re: Display message with a delay?
Can someone help me on this.
-
Apr 22nd, 2006, 06:36 AM
#3
Re: Display message with a delay?
with a delay in the sense??
add a timer set the interval for say 5 seconds then call the event
just a wild idea!!
-
Apr 22nd, 2006, 06:40 AM
#4
Thread Starter
Hyperactive Member
Re: Display message with a delay?
Can you give me a sample code?
-
Apr 22nd, 2006, 07:21 AM
#5
Re: Display message with a delay?
Code:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Delay(ByVal delayInSeconds As Integer)
Dim targetTime As Date
targetTime = DateAdd("s", delayInSeconds, Now())
While targetTime > Now
Sleep 50 ' reduce CPU usage
DoEvents ' keep app responsive
Wend
End Sub
Private Sub Command1_Click()
Delay (5)
MsgBox "A"
End Sub
this will show your msgbox after 5 seconds
__________________
________________0îîî___
___îîî0________(___)____
__(___)_________) _/_____
___\_ (_________(_/______
____\_)_________________
-
Apr 22nd, 2006, 07:30 AM
#6
Re: Display message with a delay?
why not just use a timer as you originally suggested:
VB Code:
Private Sub Timer1_Timer()
MsgBox "TEST"
End Sub
Private Sub Command1_Click()
Timer1.Interval = 5000
Timer1.Enabled = True
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|