Long Loop; how to stop it with button?
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!!!
Re: Long Loop; how to stop it with button?
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
Re: Long Loop; how to stop it with button?
Great! Thank you very much!!!