How to Set the Access Key in Visual Basic


The computer mouse has made life a lot easier for computer users and for most people "point-and-click" is the method of choice for navigating computer applications. But the die-hard command users prefer access key combinations, typically using the Alt key, to make their lives easier. Visual Basic makes such keys available that can be turned on for any control on the screen.

  • Build the Visual Basic form for your application, using Windows standards for menu items, buttons and other standard controls. Windows standards are implemented in every Microsoft application so you have to look no further than Microsoft Visual Basic itself for most of them. Any underlined letter in the text of a menu item, button or other control identifies the access key for that control.

  • Determine the controls on your Visual Basic form for which you want to assign access keys. Decide which key will be your access key for each control. Of course, each control must have a different key for your application to determine which control your access key combination is to invoke.

  • Click on a control such as the "File" menu item to select it. Scroll down in the Properties window to find the Text property for the control. Insert an ampersand (&) before the character that you want to be the access key. For example, the Text property of the File menu item would be "&File" to make Alt-f the access key combination.

  • Click the Debug menu item at the top of the Visual Basic screen to test your access keys. When your form appears press the Alt key to see an underline under the access key in the File menu item. Hold down the Alt key and press "f" to activate the File menu item. This indicates that you have successfully set the access key.

Related Searches


  • Photo Credit Ryan McVay/Photodisc/Getty Images
Promoted By Zergnet



You May Also Like

  • How to Use Sendkeys in Excel

    Excel is a spreadsheet program included in the Microsoft Office suite of productivity software. It is commonly available on PCs and Macs....

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

Is DIY in your DNA? Become part of our maker community.
Submit Your Work!