Resolved Can one menu item appear on multiple menus?

Post number 2 has been selected as best answer.

aaaron123@roadrunner.com

Well-known member
Joined
Jan 23, 2011
Messages
47
Programming Experience
10+
Many times I have usercontrol1 on usercontrol2 on form.

Usercontrol1 contains a context menu with items that need to be repeated on usercontrol2 and/or on form.

When they added Toolstrip to VS, as I remember it, we were advised that a menu item could only be on one menu.

It could be moved around but could not be cloned.

So I wrote a clone class and have been using that.

A couple of things: That was some time ago, and I thought I'd try c# and wrote in c#. I look at that code now (it was the only time I used c#) and it looks like a collection random characters.

I saw something on the Internet recently that SEEMED to say a reference to a usercontrol1 menu item could be shipped to the form and displayed there.

I tried a little test case (in the c# code so there was some guessing going on), and at least in that case it did not work.

What do you think. Can one menu item appear simultaneously on multiple menus?

If so, you wouldn't happen to know where there was an example, would you?
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,295
Location
Sydney, Australia
Programming Experience
10+
I've never tried to add one item to two menus but it's easy enough to test for yourself, so there's no need to ask. Just create a menu, add two items, add a subitem to one of them and then, at run time, try adding that existing subitem to the other item. Either it will work or it won't. If it does then you're good to go. If it doesn't and you suspect that you may have done something wrong, you'd need to show us what you did so that we can check.

If you're talking about a whole menu rather than just certain items then you can certainly use that in multiple places. You can even assign a ContextMenuStrip to the DropDown property of another menu item to have the same items appear as a submenu on multiple MenuStrip or ContextMenuStrip items.
 

aaaron123@roadrunner.com

Well-known member
Joined
Jan 23, 2011
Messages
47
Programming Experience
10+
I've never tried to add one item to two menus but it's easy enough to test for yourself, so there's no need to ask. Just create a menu, add two items, add a subitem to one of them and then, at run time, try adding that existing subitem to the other item. Either it will work or it won't. If it does then you're good to go. If it doesn't and you suspect that you may have done something wrong, you'd need to show us what you did so that we can check.
This I've done - works OK. What I tried was to pass a reference to a Toolstripmenuitem from a usercontrol to a form and add it to a menu there. Maybe if I did it differently it would work but what I tried didn't. But maybe I don't really need to do that.


If you're talking about a whole menu rather than just certain items then you can certainly use that in multiple places. You can even assign a ContextMenuStrip to the DropDown property of another menu item to have the same items appear as a submenu on multiple MenuStrip or ContextMenuStrip items.
I think if I arrange things differently this might be all I need. I have to check. Do you remember if we could assign a ContextMenuStrip to a DropDown when Toolstrip was first made available?

I'm pretty sure, back then, we were told that a menu item could not simultaneously be on more than one menu. Do you think I'm wrong here (won't be the first time I misread something).

[/QUOTE]
 
Top Bottom