Click here to Skip to main content
15,893,381 members
Articles / Programming Languages / C#

Close Application at Press of Escape Button

Rate me:
Please Sign up or sign in to vote.
4.88/5 (18 votes)
10 Nov 2011CPOL 72.5K   15  
How to close Form at pressing of Escape Button.

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
1 Jul 2011johannesnestler
Your tip is useful for main forms with no close or cancel button. But most time you will want the "escape-close-form-behaviour" only with dialogs. This is the recommended way to do it: (Now i see Indivara already mentioned it in the comments)using System;using...

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions