Delay or Pause Execution: Enhanced.
Version Compatibility: Visual Basic 6, Visual Basic 5
I found a snippet of code on this web site, written by Steve Bazinet, which allows you to delay execution for a number of seconds. The article is here: http://www.freevbcode.com/ShowCode.asp?ID=1104 It's really useful but I found the processor usage hit's 100% while the app is pausing. This is because it is in a tight loop checking for the exit condition and calling DoEvents. If you add a small "sleep" period to the loop, the processor usage drops dramatically without affecting its operation. I've copied the entire code from Steve's article with the appropriate changes. The changes are the addition of a declaration statement for the Sleep function and then calling the function in the loop with a delay of 200ms.
Instructions: Copy the declarations and code below and paste directly into your VB project.