Any ideas how you can pause a VB program in code without having to reference a timer ? I need to be able to tell the program to not do anything for 5 seconds. I used to be able to do it in C++ with the Wait command I think.
Printable View
Any ideas how you can pause a VB program in code without having to reference a timer ? I need to be able to tell the program to not do anything for 5 seconds. I used to be able to do it in C++ with the Wait command I think.
This pauses by the number of seconds
or you can use Sleep which pauses for a number of miliseconds.Code:Public Sub Pause(Duration As Double)
Dim Current As Long
Current = Timer
Do Until Timer - Current >= Duration
DoEvents
Loop
End Sub
Private Sub Form_Load()
Pause 5
End Sub
Code:Private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
Private Sub Form_Load()
Sleep 5000
End Sub