Click here to Skip to main content
15,886,689 members
Articles / Desktop Programming / Windows Forms
Alternative
Tip/Trick

Implementing shortcut keys for toolstrip

Rate me:
Please Sign up or sign in to vote.
2.00/5 (1 vote)
23 Aug 2011CPOL 11.1K   2
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)


Written By
Student Univeristy of Antwerp
Belgium Belgium
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralReason for my vote of 2 You can't assign a toolbar button to... Pin
Armando de la Torre7-Sep-11 14:27
Armando de la Torre7-Sep-11 14:27 
GeneralRe: Aah, didn't know that. Thought any button would do. Thanks f... Pin
KenBonny7-Sep-11 20:58
KenBonny7-Sep-11 20:58 
Aah, didn't know that. Thought any button would do. Thanks for sharing.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.