Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Jan 13, 1999

Custom Menu Accelerators

To set the shortcut key of a menu item to something other than what the VB menu editor displays, use this code in the Form_Load event of a form:
 
	Private Sub Form_Load()
		mnuExit.Caption = mnuExit.Caption & vbTab & "ALT+F4"
	End Sub
This adds the text "ALT+F4" to the caption of the mnuExit menu item and right-justifies it with any other shortcuts on the menu. ALT+F4 is already supported by Windows to close a window, so this shortcut needs no additional code for an exit menu choice. If you add shortcuts that Windows doesn't internally support, then set the KeyPreview property of the form to True and check the KeyUp event on the form to see if the shortcut was selected.
Dave Kinsman
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date