Like in Q-basic where you can give the "Sleep" command. Is there something similar in vb.
I know you can do it with a timer/ Is there any other way, or is there just a "Sleep" command. I want my program to pause for 5 seconds.
Thanks,
M
Like in Q-basic where you can give the "Sleep" command. Is there something similar in vb.
I know you can do it with a timer/ Is there any other way, or is there just a "Sleep" command. I want my program to pause for 5 seconds.
Thanks,
M
Place this in a module
And the command to use isVB Code:
Public Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
Mega.VB Code:
Sleep (5000) ' This is 5 seconds
There is a Sleep API
VB Code:
Public Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
While Sleep will work you may find that it is disruptive because it seems to lock up your program. Another way is to use an idle loop.
VB Code:
'Call in miliseconds '1000 milsecs = 1 sec OneSecond 10000 Public Sub OneSecond(iInterval As Long) Dim lStart As Long lStart = GetTickCount() While GetTickCount() - lStart < iInterval DoEvents Wend End Sub
Greg