Question[Help]Sleep/Pause[Solved]

Posts 1–12 of 12 · Page 1 of 1
[Help]Sleep/Pause[Solved]
whats the wait code in visual basic 2008? thanks >.<
How long are you trying to make it wait for?
Sleep() function in the kernel32 library. I think for VB you have to declare these things manually. After you've done this.

Sleep(milliseconds)
In vb 2008
the code to pause a thread is simply:
Threading.thread.pause(1000)
Where 1000 = milliseconds
Obama is right. thanks for helping
[php]
' To Sleep
System.Threading.Thread.Sleep (1000)
'To Pause
System.Threading.Thread.Pause (1000)

' Code uses Miliseconds
[/php]

Obama was demonstrating the power of google


:waits for OP' to accept answer:

Quote Originally Posted by NextGen1 View Post
[php]
' To Sleep
System.Threading.Thread.Sleep (1000)
'To Pause
System.Threading.Thread.Pause (1000)

' Code uses Miliseconds
[/php]

Obama was demonstrating the power of google


:waits for OP' to accept answer:

Lies, I knew that
Here =)

Code:
Private Declare Sub Sleep Lib "kernel32" _
 (ByVal dwMilliseconds As Long)

Public Sub Wait(Seconds As Single)

 Dim lMilliSeconds As Long
 lMilliSeconds = Seconds * 1000
 Sleep lMilliSeconds

End Sub
or

Use Call Delay(integer)

Code:
Sub Delay(dblSecs As Double)
Const OneSec As Double = 1# / (1440# * 60#)
Dim dblWaitTil As Date

dblWaitTil = Now + OneSec * dblSecs
Do Until Now > dblWaitTil
DoEvents ' Allow windows messages to be processed
Loop
Quote Originally Posted by Unkn0wn_h4cker View Post
Here =)

Code:
Private Declare Sub Sleep Lib "kernel32" _
 (ByVal dwMilliseconds As Long)

Public Sub Wait(Seconds As Single)

 Dim lMilliSeconds As Long
 lMilliSeconds = Seconds * 1000
 Sleep lMilliSeconds

End Sub
or

Use Call Delay(integer)

Code:
Sub Delay(dblSecs As Double)
Const OneSec As Double = 1# / (1440# * 60#)
Dim dblWaitTil As Date

dblWaitTil = Now + OneSec * dblSecs
Do Until Now > dblWaitTil
DoEvents ' Allow windows messages to be processed
Loop
Yay, Someone else who can use Google
Yup,suits the cause ^.^ I normally make a simple pause code and make a sub for it and call it when I need it,but I couldn't be bothered typing
Hey on mine

system.threading.thread.sleep(1000) works

and

threading.thread.sleep(1000) work but

these don't work

system.threading.thread.pause(1000)

or

threading.thread.pause(1000)
it may be system.threading.thread.suspend

I'm going by memory, I don't use them often
Posts 1–12 of 12 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us