Thats because the UI thread is busy running the business object's method and cannot service the windows message pump. Start up the long running process on a worker thread:
ThreadStart ts = new ThreadStart(yourBusinessObject.YourLongRunningMethod);
Thread t = new Thread(ts);
t.Start();
I thought this article has a pretty decent explanation of multithreading
http://www.gekko-software.nl/DotNet/Art05.htmIf you understand everything in the article then you will have no problem doing what you want to do.
I don't want to overload you but as an alternative to starting threads you can use the asynchronous capability of delegates
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpovrasynchronousdelegates.asp>Dave
>
>I tried this and it works before I click the OK button and start processing. Once the business object takes over and the processing loop is being executed, the escape key is no longer seen.
>
>Thanks again for your help and any additional ideas.
>
>Kind Regards,
>
>Mat
>
>
>>I haven't tried it but I think to capture the escape key you need to override the form's ProcessDialogKey method
>>
>>
>>protected override bool ProcessDialogKey(System.Windows.Forms.Keys keyData)
>>{
>> System.Windows.Forms.Keys key = keyData;
>> if(key == System.Windows.Forms.Keys.Escape)
>> {
>> // tell the business object to cancel here.
>> // may have to have some thread synchronization
>> // logic (locks) on the business object
>> // if its running on another thread.
>> }
>>}
>>
>>
>>HTH,
>>Dave
>>
>>>The progress bar is registered as a listner, but I am not sure how to register the form as a listner and then test for the escape key.
>>>