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
MSDN Subscribers: Download the VS 2010 Release Candidate
MSDN Subscribers: Download the VS 2010 Release Candidate
Sell Your Code and Make Money?
Creating your own Tetris game using VB.NET
Article :: Improving Software Economics, Part 4 of 7: Top 10 Principles of Iterative Software Management



Go Back   VBForums > Visual Basic > Visual Basic .NET

Reply Post New Thread
 
Thread Tools Search this Thread Display Modes
Old Jun 3rd, 2007, 12:54 PM   #1
neef
Addicted Member
 
neef's Avatar
 
Join Date: Dec 01
Location: Boston
Posts: 232
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 02:39 PM.
neef is offline   Reply With Quote
Old Jun 3rd, 2007, 02:09 PM   #2
Troy Lundin
Hyperactive Member
 
Troy Lundin's Avatar
 
Join Date: May 06
Posts: 378
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, 02:28 PM   #3
neef
Addicted Member
 
neef's Avatar
 
Join Date: Dec 01
Location: Boston
Posts: 232
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, 02:31 PM   #4
Troy Lundin
Hyperactive Member
 
Troy Lundin's Avatar
 
Join Date: May 06
Posts: 378
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 Search this Thread
Search this Thread:

Advanced Search
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 11:56 AM.




To view more projects, click here

Acceptable Use Policy


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.