I
IdleBrain
Hello all,
The sleep() method hangs up the application and does not respond to
events. So, I wrote a small delay loop that will allow the application
to respond to events.
'Use Delay(500) to delay the application for 500ms.
Public blnSleepTimeExpired As Boolean
Public Sub Delay(ByVal intSleepTimems As Integer)
'set interval.
Dim intCount As Integer
tmrDelay = New Timer
tmrDelay.Interval = intSleepTimems
blnSleepTimeExpired = False
tmrDelay.Start()
Do While (Not blnSleepTimeExpired)
intCount += 1
If (intCount Mod 25) = 0 Then DoEvents()
'Debug.WriteLine(intSleepTimems & " Count: " & intCount)
Loop
tmrDelay.Stop()
End Sub
Private Sub tmrDelay_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles tmrDelay.Tick
blnSleepTimeExpired = True
End Sub
The code works most of the time but hangs up the application once a
while.
Can anyone help me with code that would do nothing but wait for certain
time.
I appreciate any help on this issue.
Thanks.
The sleep() method hangs up the application and does not respond to
events. So, I wrote a small delay loop that will allow the application
to respond to events.
'Use Delay(500) to delay the application for 500ms.
Public blnSleepTimeExpired As Boolean
Public Sub Delay(ByVal intSleepTimems As Integer)
'set interval.
Dim intCount As Integer
tmrDelay = New Timer
tmrDelay.Interval = intSleepTimems
blnSleepTimeExpired = False
tmrDelay.Start()
Do While (Not blnSleepTimeExpired)
intCount += 1
If (intCount Mod 25) = 0 Then DoEvents()
'Debug.WriteLine(intSleepTimems & " Count: " & intCount)
Loop
tmrDelay.Stop()
End Sub
Private Sub tmrDelay_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles tmrDelay.Tick
blnSleepTimeExpired = True
End Sub
The code works most of the time but hangs up the application once a
while.
Can anyone help me with code that would do nothing but wait for certain
time.
I appreciate any help on this issue.
Thanks.