Trailmax Tech

Max Vasilyev: ASP.Net MVC development in Aberdeen, Scotland
Skip to content
  • My Talks
  • cacheCopy
  • NSaga
  • Cake.SqlServer
  • About

C#: How to close the windows form by pressing ESC button on keyboard?

Posted on February 20, 2012February 20, 2012 by trailmax

set the form’s KeyPreview property to true, and add this override to the Form code:

protected override void OnKeyDown(KeyEventArgs e)
{
    base.OnKeyDown(e);
    if (e.KeyCode == Keys.Escape)
        this.Close();
}
Uncategorized   .Net, c#

Tags

.Net asp.net Autofixture automation azure Azure-DevOps bat build server BuildServer c# cakebuild commands Dependency Injection di drivers eclipse EntityFramework git html https Identity iis java javascript jquery Linux microsoft mocking mvc OpenXml recipe regexp Registry script sql sql server stackoverflow testing tfs unit-testing Vista visual studio Windows Wireless XP

Blogroll

  • HR.Net Consaltancy and blog
  • My Git Cheat-Sheet
  • My Twitter
  • Wordpress Hosting

Recent Posts

  • Laundry Basket Bias
  • mstsc.exe vs HD screen
  • Windows Terminal
  • Using private NuGet feed with dotnet publish
  • Keyboard Shortcuts for Git in Visual Studio
Powered by WordPress | Theme: Bootstrap Basic