PDA

Click to See Complete Forum and Search --> : Re: Delay executing


Nov 26th, 1999, 06:29 AM
Without using timer control, what would be the best way to delay execution of code?

I would like to pause the program for about 1/10 of second before executing th. I could just use For loop to run for, say, 100K times, but I would rather use a function call or so.

Thanx.

SK

MartinLiss
Nov 26th, 1999, 12:24 PM
This will do it:
Dim dblEndTime As Double

dblEndTime = Timer + 0.5
Do While dblEndTime > Timer
' Do nothing but allow other
' applications to process
' their events.
DoEvents
Loop


------------------
Marty

Aaron Young
Nov 26th, 1999, 01:05 PM
There is also the Sleep API which will pause your Apps Processes for a Given number of Milliseconds..

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

Private Sub Command1_Click()
Caption = "Ready.."
Sleep 100 'Pause for 1/10 of a Sec.
Caption = "Go!!!"
End Sub


------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net