>Fred:
>
>You are right! It stops properly now.
>
>Thank you for your advice.
>
>
>Mike Smith
Glad it helped, Mike.
If you find that your loop has been slowed down considerably, you might want to execute the DOEVENTS only after several iterations of your loop have ocurred.
nCounter = 0
FOR x=1 TO 1000
nCounter = nCounter + 1
IF MOD(nCounter,50)=0
DOEVENTS
ENDIF
IF YourStopCondition
EXIT
ENDIF
...
ENDFOR