views:

42

answers:

1

Hi is there any way to handle Esc key event in winforms? Actually it is working fine when i put debegger in the code. Once i remove the debugger it is not getting fired.

Whats the problem here?

Thank you

+2  A: 

If it is for a dialog then you can set the property CancelButton (of the form) to the button that cancels (e.g. named btnCancel and with text "Cancel" in a English language application.)

In this case you don't need to handle the key event for the Esc key.

Peter Mortensen