Note that this aproach will only succeed if the loop is started with a
asynchronous delegate
Otherwise the form will simply freeze untill the loop has completed
and pressing the close button will result in a " This program is not
responding message "
But for the rest you are right you can then set a boolean flag to jump
out of the loop and let the function or a property setter return the
value to the initial caller
regards
Michel Posseth [MCP]
Hello Andreas,
Ah, I misunderstood as well. If yer looking for how to interrupt at
form close, perhaps for the purpose of continuing the long op at the
next run.. it's pretty simple.
Im the Form_QueryClose event set a varaible.. like bFormClosing to
True.. Then in the loop ask the variable if the form is closing.. and
if it is, exit the op. (Exit For).
-Boo
No, Ahmed I am thinking at the event of closing my form.
Do you mean this:
dim iAfterLoop as integer
for i as integer =1 to 10000000
if i = something then
iAfterloop = i
end for
end if
next
Ahmed
andreas wrote:
When I do a long calculation is there a possibility to interrupt
this calculation properly?
For i as integer = 1 to 100000000
do something
next
and retrieve the i at the moment of the interrupting
Thanks for any response