Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to make short cuts of a button.. like Alt + F4 and also how to make a form load into an specific area without changing the menustip items and all..
like if we build an application having buttons on the toolstrip, say each button opens a new form but the buttons on the toolstrip doesnt change.
Posted

With regular buttons, the easiest way is to add an ampersand character to the Text property, immediately before the character you want to use:
C#
myButton.Text = "Hel&p";
When the user presses ALT+P, the button will be activated.

This also works with labels: they will activate the next control in the Tab Order , so a label with the text
C#
myLabel.Text = "&User Name:";
will activate the textbox after it when ALT+U is pressed.
 
Share this answer
 
Comments
Espen Harlinn 23-Jul-12 4:10am    
Nice reply :-D
Well with due respect it was known to me. Can't I use F4 or other keys like dat for the purpose.
 
Share this answer
 
Hope that helps

if (e.KeyCode == Keys.F4)
{
button1_Click(sender, null);
}
 
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