Solved

Wait function in VB5

Posted on 1999-01-06
4
399 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

943 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now