View Single Post
  #3 (permalink)  
Old 12-02-2008, 9:42 AM
Adagio Adagio is offline
VB.NET Forum Fanatic
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Dec 2005
Posts: 133
Reputation: 56
Adagio is on a distinguished programming path ahead
Default

Quote:
Originally Posted by JuggaloBrotha View Post
When you start the thread, set the form's CancelButton property to nothing, that'll prevent the form's closing code from running, next you'll need to use the form's KeyUp event to detect the escape key and if the thread's running, cancel it and reset the form's CancelButton property back to your cancel button.

Also when the thread completes successfully be sure to re-set the form's cancel button property to your button.
Ah yes, that is a possibility, I'll try that

Thanks for the tip

Quote:
Originally Posted by JuggaloBrotha View Post
Pretty much what you've already concluded to, I'd just use the KeyUp event instead of KeyDown for Escape key checking.
Ok


I just found a could be solution for that problem. Setting the KeyPreview on the form to true, the forms KeyUp (or KeyDown) event is fired when ESC is pressed, no matter which control is activated... that should take care of that problem
Reply With Quote