Click to See Complete Forum and Search --> : How do I make the Loop to check a Variable every 1 second?


elik
June 25th, 2001, 09:59 AM
Hello, I need to make a while loop that checks a global Variable every 1 second. I tried to make it with No time limit, but it make the system crash,May be because it is an infinte loop.
thanks,
here is the code:
While Loop_Working
If Global_Flag = True Then
Loop_Working = False

GoTo Handle_Second_One
End If
Wend


Eli

shree
June 25th, 2001, 10:04 AM
Use a timer.

Clearcode
June 25th, 2001, 10:05 AM
Because Visual basic only operates on a single execution thread, the code that you want to set the global flag can never be set.

You could include a DoEvents in the loop such that whatever event sets the global variable may fire.

HTH,
D

-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com