How can i make a delay function like the one in pascal ??
Printable View
How can i make a delay function like the one in pascal ??
Just try this piece of code:
Hope this helps...Code:Private Sub Command1_Click()
Dim Start
Start = Timer
Do While Timer < Start + 3
DoEvents
Loop
MsgBox "Paused for 3 seconds"
End Sub
Lior, An Israeli Programmer.
Or use this API
and replace Liors timer with Gettickcount if u want precision in millisecsCode:Declare Function GetTickCount Lib "kernel32" Alias "GetTickCount" () As Long
or look at my post here http://forums.vb-world.net/showthrea...threadid=15229 for precision in microseconds
Use the Sleep API for a total pause. (The user can't do
anything to your program):
andCode:Public Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
I use this to make the user think that my program is dealingCode:Sleep (5000)
MsgBox("Tihihi. Thought I'd crashed, didn't you?")
with memory and all that (muhahahahah) ;)