How to delay a VB program without using
the API
Here is a way to delay an event or even stop everything for any amount of time.
To delay an event and let windows handle other stuff use this code: Public
Sub Delay(HowLong as date)
TempTime=DateAdd("s", HowLong, Now)
While TempTime > Now
DoEvents 'Allows windows to handle other stuff
Wend
End Sub
Or if you don't want windows to handle other background stuff use this code: Public
Sub Delay(HowLong as date)
Dim TempTime as Date
TempTime=DateAdd("s", HowLong, Now)
While TempTime > Now
Wend
End Sub
So, to make the program wait for 5 seconds use the following code: Delay
5
'other code here that will not be done
'until after the delay
|