Results 1 to 3 of 3

Thread: Help with Menu Shortcuts

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2013
    Posts
    2

    Help with Menu Shortcuts

    I am a beginner with Visual Basic (currently using VB.Net Express 2010). I am having a problem with one of my menu shortcuts. This is a very simple menu, simply as a means of practice.

    During debug mode, when I press 'Alt & f', my shortcut for 'File' works fine. However, when I press 'Alt & x' for Exit this does not work. The confusing thing is, if I click on Exit this works as it should, so I cannot understand why the shortcut does not.

    Any help would be much appreciated.

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,413

    Re: Help with Menu Shortcuts

    here's how to add menu items in code. notice the ampersands. they denote Alt + the character after the ampersand = the shortcut.
    the same system applies to menu items you add in the designer. when you set the text include the ampersands :

    Code:
    MenuStrip1.Items.Add("&File", Nothing, AddressOf clicked) 'keyboard shortcut = Alt+f
    MenuStrip1.Items.Add("E&xit", Nothing, AddressOf clicked) 'keyboard shortcut = Alt+x

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2013
    Posts
    2

    Re: Help with Menu Shortcuts

    Thank you for your help Paul

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width