Using MenuStrip menu as context menu.

rbulph

Junior Contributor
Joined
Feb 17, 2003
Messages
397
I'd like to have a menu in the menustrip of my form which doubles up as the context menu of a control in my form. Can I do this, or do I need to have a context menu which replicates every item in the menustrip menu?
 
As far as I know you will have to have a seperate menu. However, what you can do, is make the same method handle the click event for the menu items on both menus...

Visual Basic:
Handles MenuItem1.Click, MenuItem2.Click
 
Yes, I'm aware you can do that. And I think I can generate the menu at run time in code. But I do think it's a bit poor that I have to do so.
 
Yeah, I agree. A menu *should* be a menu... whether it is a context menu, or part of a menu bar... but for now, you'll just have to do it in code or design time. Either way it isn't hard.
 
Do it the other way round - design your context menu with the correct items and then on the menu strip go to it's DropDown property - then you can select your context menu and have it appear as part of the Main Menu.
 
PlausiblyDamp said:
Do it the other way round - design your context menu with the correct items and then on the menu strip go to it's DropDown property - then you can select your context menu and have it appear as part of the Main Menu.
Lovely. Thankyou.
 
Back
Top