Page 1 of 1

Posted: Sun Feb 29, 2004 9:13 pm
by CyberGenesis
How the hell do you do delays in vb?

Posted: Sun Feb 29, 2004 9:22 pm
by Starfyre

Private Sub Command1_Click()
Call Sleep(txtTime)
End Sub


Tadah.

Posted: Sun Feb 29, 2004 10:00 pm
by CyberGenesis
EDIT: nvm...i got it

(Edited by CyberGenesis at 3:20 pm on Feb. 29, 2004)

Posted: Sun Feb 29, 2004 10:20 pm
by ODDin
You create a timer, and make its interval the time you need to wait. In the code of the timer, you insert what you need to do after the delay, and when you want to start the delay, you activate the timer.
There's another option (I prefer to use this), but it requiers your code to be a procedure. You make a boolean paramter. If it's false, you run part (a), and activate the timer. In the timer, you call back that procedure, defining the parameter as true - thus activating part (b).

It's annoying, I agree. I believe there is a way to freeze the program - only problem that it freezes the whole system, and that's... well, bad.

Posted: Sun Feb 29, 2004 10:56 pm
by CyberGenesis
im using a module with this in it:

Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

yeah...it halts it but...i have no sounds so i couldn't care less as long as it works