Set Enter and Esc Keys in Windows application C#.Net

In this post, we will discuss how to set Enter and Esc keys in C#.Net windows application. You can also check out my previous posts on:
Suppose I have a Windows Form and two buttons name as btnEnter and btnEsc. I want when the user clicks on entering, btnEnter should respond and similarly when the user clicks on Esc, btnEsc should respond.
Set Enter Key:
For this Open windows form properties, from the properties window, select btnEnter in the AcceptButton properties as shown in the fig below:
Set Esc Key:
For this Open windows form properties, from the properties window, select btnEsc in the CancelButton properties as shown in the fig below:
After that when you open the form, click on Enter key, btnEnter will fire and if you click on Esc, btnEsc code will fire.

You May Also like the Following SharePoint Online Tutorials:

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →

Leave a Reply