Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cancel a long running process
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
00945712
Message ID:
00945850
Views:
18
Hi Matthew,

How do you call the calculation from the Ok button? Do you use delegates?
If you run the calculation on the same thread as the UI, I doubt that you can cancel it, even if you do Application.DoEvents. Your cancel will be called after the calculation is done, because DoEvents is queueing all the requests and processes them sequentially.

My suggestion is to use delegates for the time consuming calculation.

I ran into a similar issue but in my case I used async callback with delegates.
From the main UI I instantiate an object that handles the calculation,and inside the object I invoke the delegate asynchronously.;
If the user wants to cancel the process, what I do is, I keep a reference to the asynccallback in the calculation handler class and call AsyncWaitHandle.Close() on it. For me, this trick did it.

Hope it helps,

Vlad
Previous
Reply
Map
View

Click here to load this message in the networking platform