Wednesday, October 18, 2006

Visual Basic: How to Sleep or Pause a Visual Basic Program Execution for Time Period

Another one of those quick tips that I always forget. In order to use a Sleep function in Visual Basic, include the following library declaration in any module or form:

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Lets say you need to pause a programs execution by 5 seconds. You would call the function like so:

Sleep(5000)

6 comments:

Buey said...

Thank you good sir.

Suranjan said...

thank youuuuuuuuuuu

Anonymous said...

Thanks :)

Anonymous said...

Thank you!

Anonymous said...

Thank you, i was looking for this :-)

Code Postal said...

Thanks a lot.
Simple and efficient !