Powered by Blogger.

Sunday, March 2, 2014

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:

- Get stored procedure source text in sql server 2008

- Sequence in SQL Server 2012

- Difference between Sequence and Identity in Sql Server

Suppose I have a Windows Form and two buttons name as btnEnter and btnEsc. I want when use click on Enter, btnEnter should respond and similarly when user click 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.



0 comments

Post a Comment