MRU List

Troy

Well-known member
Joined
Feb 7, 2005
Messages
153
Programming Experience
10+
I'm having fits with the new MenuStrip in VB 2005. Can anyone help me with designing an MRU List with 4 places. Seems it doesn't work the same as MenuItem and there is no Index number in the ToolStripMenuItem.DropDownItems so I can't figure out how to list them.

I found an old sample using VB 2003 and Collections but it didn't function properly with the MenuStrip in VB 2005.

God I wish Microsoft would quit frigin changing the structure of VB. Trying to relearn VB everytime they come out with a new version is getting annoying.

What happened to the old days when you could learn the basics and then learn a few new commands with new versions.

Now you have to learn completely new commands every time they decide to make an upgrade.
 
Three lines to ask the question and three lines to whine about progress. The MainMenu is still available in .NET 2.0 if you want to use it. The MenuStrip is much better for those who want to learn its use.

It's as simple as:
VB.NET:
parentItem.DropDownItems.Add(New ToolStripMenuItem(filePath))
Note that I've never used that before myself. I just used the logic that if you used Items.Add with a MainMenu then you probably use DropDownItems.Add with a MenuStrip. Voila! The whole Framework operates in a very logical way. Whenever you want to add something to a collection you invariable call the collections Add method.
 
Further, to get an item from a collection you use the Item property and provide an index. Because the Item property is always the default property for a collection you can omit the ".Item" and jsut provide the index. This is exactly the same for the old MainMenu and the new MenuStrip. The only thing that's changed is you're using DropDownItems instead of MenuItems and you're adding ToolStripMenuItem objects instead of MenuItem objects. The names have changed but the paradigm is exactly the same.
 
Back
Top