Delaying a Visual Basic Program
Here is a very useful means of creating a known delay in VB. in case you need to wait
on a different external process to finish. I recently needed a delay that was
independent of CPU clock speed. This does the trick nicely. VB doesn't have a delay
or wait function like most of the other basic languages it seems.
Declarations
Copy this code into the declarations section of the project. Declare
Sub Sleep Lib "kernel32" _
(ByVal dwMilliseconds As
Long)
Use
To delay
the program for 1 second, use this code: Call Sleep(1000)
|