Solved

Wait function in VB5

Posted on 1999-01-06
4
416 Views
Last Modified: 2008-02-26
Is there a wait or sleep function in VB5 that I can use to release the cpu and suspend execution for a period of time?
0
Comment
Question by:gemme
4 Comments
 
LVL 3

Expert Comment

by:jjbyers
ID: 1454389
I use the DoEvents and a do loop like this.

Dim EndTime As Date

  EndTime = Format(Now + #12:00:10 AM#, "long time")
  Do Until Format(Now, "long time") > EndTime
    DoEvents
  Loop

Hope this helps.
0
 

Accepted Solution

by:
jmnolan earned 100 total points
ID: 1454390
You can use this API call. It waits a specified number of milliseconds and then continues executing your program.

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

For a one second delay do this:

Sleep 1000

Hope that helps!
0
 

Author Comment

by:gemme
ID: 1454391
Thanks I will try this.
0
 
LVL 1

Expert Comment

by:bear454
ID: 1454392
DoEvents()
Check it out in vbhelp
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question