private sub CmdUserBreak_Click()
UserBreak=true
end sub
private sub Form_load()
UserBreak=false
end sub
Private sub DoMyLoop()
do
do events
if UserBreak then msgbox("User breaks!":exit sub
loop
end sub
Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
But like the other guys don't forget Do Events Give a man a program and tomorrow he will be hungry.
Teach a man to program and he will never hunger again.
--Sunr¿se
for i = 0 to upper 'upper can be some really big number
if userCanceled then exit for
'do the loop code
if i mod 100 = 0 then 'only run the doevents after every 100th iteration, this save some processor overhead..
doevents
endif
next i
'================
If it is really critical that the code stop execution immediately after the button has been pressed, then by all means forget the iteration test. If you are searching for files and you just want to stop the search, then the iteration test will help emmensly(sp?)....
hi,
Thanks all. it is actually a nested loop and i have put the
'do events' statement in the outer loop, as i don't need that much time accuracy and it worked.
Radha
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.