This concept always fascinated me. I always wondered how to do it in .NET. Then came the MSDN in rescue. So here I am sharing a tip to do it.
Step 1 : In the windows form there is a property KeyPreview make it to True . By default it is False.
Step 2 : In the KeyDown event of the form write this small code.
if (e.KeyCode == Keys.Escape)this.Dispose();
4 comments:
nice
another way is make a hidden button
and set form's cancelbutton property
to hidden button.
Write the code for hidden button.
this.close();
@mahendra Kool idea
Post a Comment