Click to See Complete Forum and Search --> : Long Loop; how to stop it with button?


Step
September 21st, 2001, 02:52 AM
I have a big loop (read data with COM) and I would like to stop the loop
with a pressed button - How can I stop the loop in an easy way? I do not want to use a timer which reads the data in intervalls (cause this will fill the message queue)
Thank you!!!

Cimperiali
September 21st, 2001, 03:02 AM
in general section:
dim blnExit as boolean
'your loop inside the form
do while ....
DoEvents 'this will enable processing informations and command meanwhile
'so be sure to lock all controls excepted the cancel button!
if blnExit = true then exit do
...
loop
'your stop button
private sub command1_click()
blnExit = true
end sub

Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.

The Rater

Step
September 21st, 2001, 03:04 AM
Great! Thank you very much!!!