Click here to Skip to main content
15,847,750 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to enable ENTER key in windows application???
Richard MacCutchan 28-Feb-13 4:35am    
Enter key is always enabled. But if you want a detailed answer you need to edit your question and add a lot more detail.
Shubh Agrahari 28-Feb-13 4:37am    
what it mean.....what actually want to do...?

If you mean "how do I make the ENTER key work the OK button" then it's pretty simple:
1) Set the Button "DialogResult" to "OK" if you want it to close the form and return OK. Otherwise, leave it as "None"
2) In the Form properties, Set the "AcceptButton" property to the button you want ENTER to work.
3) Handle the button click event as normal.

When your user presses ENTER, you will get a Click event fro your button, and / or the form will close and return DialogResult.OK.
Share this answer
hi Harsha

may this will help you...
Responding to keyboard interactions using c#[^]

happy to help
Share this answer

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900