To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
Part 10 of the Visual Basic .NET 2010 Express Tutorial Complete!
How to Use the Visual Studio Code Analysis Tool FxCop
Article :: Interview with Andrei Alexandrescu (Part 3 of 3)
Introducing Visual Studio LightSwitch
Visual Studio LightSwitch Beta 1 is Available



Go Back   VBForums > Visual Basic > Visual Basic .NET

Reply Post New Thread
 
Thread Tools Display Modes
Old Jun 3rd, 2007, 11:54 AM   #1
neef
Addicted Member
 
neef's Avatar
 
Join Date: Dec 01
Location: Boston
Posts: 241
neef is on a distinguished road (10+)
[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.
neef is offline   Reply With Quote
Old Jun 3rd, 2007, 01:09 PM   #2
Troy Lundin
Hyperactive Member
 
Troy Lundin's Avatar
 
Join Date: May 06
Posts: 446
Troy Lundin  is on a distinguished road (30+)
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.
Troy Lundin is offline   Reply With Quote
Old Jun 3rd, 2007, 01:28 PM   #3
neef
Addicted Member
 
neef's Avatar
 
Join Date: Dec 01
Location: Boston
Posts: 241
neef is on a distinguished road (10+)
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.

neef is offline   Reply With Quote
Old Jun 3rd, 2007, 01:31 PM   #4
Troy Lundin
Hyperactive Member
 
Troy Lundin's Avatar
 
Join Date: May 06
Posts: 446
Troy Lundin  is on a distinguished road (30+)
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.
Troy Lundin is offline   Reply With Quote
Reply

Go Back   VBForums > Visual Basic > Visual Basic .NET


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:32 AM.





Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.