118 Part I Getting Started with Microsoft Visual Basic 2010
- Open the Properties window, click the ShortcutKeys property in the Misc category,
and then click the arrow in the second column.
A pop-up menu appears that helps you assign the shortcut key. - Select the Ctrl check box, click the Key list box, and select the letter T in the
alphabetical list.
The Properties window looks like this:
Tip Visual Basic normally displays the shortcut key combination in the menu when you
run the program, to give users a hint about which keys to press. To hide shortcut key
combinations from the user (if you’re running out of space), set the ShowShortcutKeys
property to False. The shortcut key still works, but users won’t see a visual reminder for it.
You can also set what will be displayed within the program as a shortcut key by setting the
ShortcutKeyDisplayString property.
- Click the Date command, and then change its ShortcutKeys property setting to Ctrl+D.
Now you’ll run the program and try the shortcut keys.
- Click the form to close the Clock menu.
- Click the Start Debugging button on the Standard toolbar.
- Press CTRL+D to run the Date command.
The current date appears in the program.
- Press CTRL+T to run the Time command.
The current time appears in the program.