In my application I have several calculation routines that can run for a long time depending on the number of records being processed. I want to give the users the ability to "cancel" processing if they want.
I have a form with some text, a progress bar, OK and Cancel buttons. Clicking on the OK button will call a calculation method in a business object. I want to use the escape key as the cancel.
I have added code to the individual controls and the form's KeyDown event to check for the escape key. I have also tested the form's KeyPreview property to override the individual controls. This all works great when the form has focus, but once I click the OK button and the business object takes over, the KeyDown event is no longer recognized.
My question is, do I need to do something in the processing loop to have it check for a KeyDown during each iteration?
Thanks in advance for any help!
Kind Regards,
Mat