blah blah blah is here! blah blah » Close

up1down
link

Oops. Just down to the final hurdle on my program to control two devices.

I need the abort button to work which as far as I can tell will only work if I use threading?

My program is fairly simple. Text boxes collect relevant data, Start_Click event runs a few checks then calls my CalculateResult method. Am I going to have to re-write the thing or can I just change the wrapping to cause CalcultateResult to run as a thread that can be interrupted by the Abort button? I haven't used threads before.

Many thanks for all your help so far and in advance for any response.

last answered one year ago

1 answers

link

I would use a BackgroundWorker, which supports cancellation. You will need to run a check inside your CalculateResult method to see if the user has ordered a cancel, but the BackgroundWorker is fairly easy to use. See this recent thread for more info.

MickW
151

Thanks for that and the swift response mate.

Feedback