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:

  1. Thank you good sir.

    ReplyDelete
  2. thank youuuuuuuuuuu

    ReplyDelete
  3. Anonymous10:41 AM

    Thanks :)

    ReplyDelete
  4. Anonymous12:07 PM

    Thank you!

    ReplyDelete
  5. Anonymous10:54 AM

    Thank you, i was looking for this :-)

    ReplyDelete
  6. Thanks a lot.
    Simple and efficient !

    ReplyDelete