Alex Rivera | Logout

How do I delay code execution in Visual Basic (VB6)?

Asked 2008-09-18T18:09:44.860
14

I have a long running process in VB6 that I want to finish before executing the next line of code. How can I do that? Built-in function? Can I control how long to wait?

Trivial example:

Call ExternalLongRunningProcess
Call DoOtherStuff

How do I delay 'DoOtherStuff'?

Edit
Report

1 Answer

16

VB.Net: I would use a WaitOne event handle.

VB 6.0: I've seen a DoEvents Loop.

Do
     If isSomeCheckCondition() Then Exit Do
     DoEvents
Loop

Finally, You could just sleep:

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

Sleep 10000
answered 2008-09-18T18:12:28.257

Your Answer