Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / desktop / WinForms

Implementing shortcut keys for toolstrip

2.00/5 (1 vote)
23 Aug 2011CPOL 11.5K  
This is nice for non standard buttons (like a CTRL + s), but OK and Cancel buttons have standard implementations in a Windows Form. Look for the properties AcceptButton and CancelButton of a Windows Form (not sure if this applies in ASP.NET or WPF, I need confirmation on that). There you can...
This is nice for non standard buttons (like a CTRL + s), but OK and Cancel buttons have standard implementations in a Windows Form. Look for the properties AcceptButton and CancelButton of a Windows Form (not sure if this applies in ASP.NET or WPF, I need confirmation on that). There you can specify a button to serve as a accept or cancel event. They will automatically be executed when the Enter and Esc keys are pressed and the form has focus.

Or write:
AcceptButton = btnOk;
CancelButton = btnCancel;

License

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