Put your VB application into deep sleep

There may be occasions when you want an application to wait for a specified
period of time without performing activity or wait loops. The Timer control
can help, but only up to 60 seconds.

The Sleep Windows API function lets you put the application to sleep. Enter the
following declaration into a standard module.

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

Then, simply call the function from your code, as in:

Sleep 5000

In this case, the 5000 milliseconds puts the application to bed for 5 seconds.
You can specify your own period of time, though.

You might also like...

Comments

ElementK Journals

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Java is to JavaScript what Car is to Carpet.” - Chris Heilmann