2

I have exactly followed the steps described in Merge menu strip items for MDI windows to create a test application with an MDI container and an MDI child with a File menu. I have tried this in Visual Studio 2013 for every .NET framework from 2.0 to 4.5, and also tried in Visual Studio 2012. The result is the same. The menus do not merge. All I get is this:

enter image description here

The two file menus are supposed to be one, or at least both be in the menu bar. What's going on? How is one supposed to get these menus to automatically merge?

Community
  • 1
  • 1
BlueMonkMN
  • 25,079
  • 9
  • 80
  • 146

1 Answers1

1

In your Form2 constructor, set the visibility of the MenuStrip control to false:

public Form2() {
  InitializeComponent();
  menuStrip1.Visible = false;
}

The "C" menu should be visible on the main form's File menu.

LarsTech
  • 80,625
  • 14
  • 153
  • 225
  • I see now that, although the instructions I was following didn't have a step for setting visibility to false, the paragraphs afterward did mention that the menu would be in both places until Visible was set to False. I guess I couldn't be bothered to read that much detail; so embarrassing since I get so frustrated when others don't read what I've written all the way through. I also hadn't noticed until after all this that the menu items *are* in the MDI parent's menu and it's only the heading that remains in the MDI child's menu strip. – BlueMonkMN Apr 10 '14 at 15:48
  • @BlueMonkMN To ease your pain, the merging of menus in WinForms was always less than obvious. – LarsTech Apr 10 '14 at 15:53
  • I have edited the original answer/instructions that I was following to make it more obvious to future readers because our world is only getting faster and more superficial. I expect many future readers will have even less time to read that answer in it's full glorious detail :). Thanks. Hopefully these two Q&A posts will make this process less painful for future visitors. – BlueMonkMN Apr 10 '14 at 15:57