|
-
Dec 19th, 2000, 10:59 PM
#1
Thread Starter
Junior Member
Hi
How to use Sleep Function In VB?? Any help on this?
thanks in advance
Karthik K
-
Dec 19th, 2000, 11:04 PM
#2
Fanatic Member
You just need to declare the API call as such...
Code:
Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
and implement it in this way..
Code:
Sleep 500 ' Causes application to stop for 500 milliseconds
It's as simple as that, you just have to be careful using the Sleep function in your apps because while it is 'sleeping' you will not be able to performs other events and such until it is completed and it may cause your application to be recognized as being idle (thanks Chris )
{Insert random techno-babble here}
{Insert quote from some long gone mofo here}
-
Dec 19th, 2000, 11:19 PM
#3
Thread Starter
Junior Member
How to use that
Hi
Thanks for the help. But how to use that Seconds..I mean I cant add more number of Zeros ..
Karthik
Thanks
-
Dec 20th, 2000, 12:24 AM
#4
Fanatic Member
Code:
Sleep 1000 ' equal to 1 second
Not quite sure what you are asking but 1000 milliseconds is equal to 1 second.
{Insert random techno-babble here}
{Insert quote from some long gone mofo here}
-
Dec 20th, 2000, 02:27 AM
#5
Guru
If you want a second-based (not millisecond-based) delay, that doesn't freeze your application while it's delaying: 
Code:
Sub Delay(ByVal nSeconds As Single)
Dim nStart As Single
nStart = Timer
Do
DoEvents
Loop Until Timer - nStart >= nSeconds
End Sub
To use:
Code:
Call Delay(17) ' Wait 17 seconds
Call Delay(1.5) ' Wait 1 second + 500 milliseconds
' etc.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|