AllAPI Network - The KPD-Team

 
Allapi Network
 API-Guide
 ApiViewer

 API List

 
API Resources
 Tips & Tricks
 VB Tutorials
 Error Lookup
 
Misc Stuff
 VB examples
 VB Tools
 VB Links
 Top Downloads
 
This Site
 Search Engine
 Contact Form
 

Donate to AllAPI.net

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

 

 


Copyright © 1998-2007, The Mentalis.org Team - Privacy statement
Did you find a bug on this page? Tell us!
This site is located at http://allapi.mentalis.org/