Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sleep function

Status
Not open for further replies.

pdbowling

Programmer
Mar 28, 2003
267
US
Hi all.
I've got a two second pause I need to implement in a program. I thought I had it with
System.Threading.Thread.Sleep (2000)
but I get compiler errors.

Is there a library I need to include? Am I totally off the mark?
Using VB6 on Windows 2000 Pro
Thanks everyone.
PB
 
>Am I totally off the mark?

In one sense yes, because the code you quote is not for VB6, rather it appears to be for VB.NET

In another sense no, because there is a Sleep API call. We've discussed its use a number of times in thios forume, so a keyword search here ought to reveal all
 
Create a new project and add one button and a text box. The place this code in

Option Explicit
Private Sub Command1_Click()
Wait (Me.Text1)
End Sub

Private Sub Wait(s As Integer)
'wait s seconds
Dim t As Date
t = Now() + s / 86400#
While t > Now()
DoEvents
Wend
MsgBox "Time is up!"
End Sub

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top