Windows Develop Bookmark and Share   
 index > Windows Forms General > How to make keyboard shortcuts for buttons in vb?
 

How to make keyboard shortcuts for buttons in vb?

How to make keyboard shortcuts for buttons in vb?

e.g: I have a button andI want it to run through the enter key in keyboard. How canI do this?
a vb beginner  Sunday, September 27, 2009 3:03 PM
If you want to fire a button's clickwith enter you should go to the form contains that button and set AcceptButton property value to that button.

Also if you set a button to CancelButton property of a form button's click is fired by esc key.

For other shortcuts you should put & just before the character that you want to be shortcut in button's text property.

Example

if you set a text property of button to &Add alt+a fires that buttons click.
  • Unproposed As Answer bya vb beginner Sunday, September 27, 2009 5:04 PM
  • Marked As Answer bya vb beginner Sunday, September 27, 2009 5:08 PM
  • Proposed As Answer byTamer OzMVPSunday, September 27, 2009 4:28 PM
  •  
Tamer Oz  Sunday, September 27, 2009 4:09 PM
If you want to fire a button's clickwith enter you should go to the form contains that button and set AcceptButton property value to that button.

Also if you set a button to CancelButton property of a form button's click is fired by esc key.

For other shortcuts you should put & just before the character that you want to be shortcut in button's text property.

Example

if you set a text property of button to &Add alt+a fires that buttons click.
  • Unproposed As Answer bya vb beginner Sunday, September 27, 2009 5:04 PM
  • Marked As Answer bya vb beginner Sunday, September 27, 2009 5:08 PM
  • Proposed As Answer byTamer OzMVPSunday, September 27, 2009 4:28 PM
  •  
Tamer Oz  Sunday, September 27, 2009 4:09 PM

You can use google to search for other answers

Custom Search

More Threads

• Need ICONS for a WinForms Application
• TreeView - Keep selected Node selected when losing focus
• Print ZPL codes to ZEBRA printer using PrintDocument class
• HelpProvider: How to SPECIFY the control
• Not able to build application on machine, not having Administrative rights
• VB Help Plz
• TableLayoutPanel for .NET 2003
• Working with DataGridView.UserAddedRow
• FileName without Path in OpenFileDialog
• Error saving RTB as bmp.