Results 1 to 4 of 4

Thread: [2005] [RESOLVED] Adding Menu Items to a Menu Control at Run Time

  1. #1

    Thread Starter
    Hyperactive Member neef's Avatar
    Join Date
    Dec 2001
    Location
    Boston
    Posts
    311

    [2005] [RESOLVED] Adding Menu Items to a Menu Control at Run Time

    I keep finding help for pre .NET 2005 menu questions so I need a straight answer:

    What's the code for adding a new menu item during runtime to a menu control created at design time? I also need an event handler as well.

    Thanks.
    Last edited by neef; Jun 3rd, 2007 at 01:39 PM.

  2. #2
    Hyperactive Member Troy Lundin's Avatar
    Join Date
    May 2006
    Posts
    489

    Re: [2005] Adding Menu Items to a Menu Control at Run Time

    Well your topic specified 2005 so I will use that.

    Create a new ToolStripMenuItem like so:
    Code:
    Dim myNewToolStripMenuItem as New ToolStripMenuItem
    Now you can add it to the existing menu like so:
    Code:
    myExistingMenu.Items.Add(myNewToolStripMenuItem)
    By the way, those examples were found by viewing the designer.vb file in my project.
    Prefix has no suffix, but suffix has a prefix.

  3. #3

    Thread Starter
    Hyperactive Member neef's Avatar
    Join Date
    Dec 2001
    Location
    Boston
    Posts
    311

    Re: [2005] Adding Menu Items to a Menu Control at Run Time

    Thank you.

    It hit me after I posted that I could check my designer and whatever code I needed would be there.


  4. #4
    Hyperactive Member Troy Lundin's Avatar
    Join Date
    May 2006
    Posts
    489

    Re: [2005] Adding Menu Items to a Menu Control at Run Time

    If your problem has been solved then please mark the thread resolved.
    Prefix has no suffix, but suffix has a prefix.

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