Visual Studio 2019: How to edit menu

Viewed 582

In Visual Studio versions prior to VS2019, .NET framework 4.7.2, if you wanted to design a MenuStrip, you just added the MenuStrip to the form and start typing the ToolStripMenuItems. Like this:

Edit MenuStrip

I've recently moved to VS2019, and started to use .NET 5. If I add a Menustrip, I get an empty strip, which seems not easy to edit (I colored the background of the main form, to clearly see the white menu strip)

VS2019 MenuStrip

My question is: how to add ToolStripMenuItems?

I see the little arrow on the right, and I can select Edit Items, but to add a menu that way is quite cumbersome.

  • If I open an old solution in VS2019, I can edit the menu as I used to do. So it's not VS2019.
  • If I create a new VS2019 project using an old .NET version, I can't edit the menu, so it's not the .NET version
  • If I copy paste InitializeComponents from an old project to a new .NET 5.0 VS209 solution I cannot edit the menu

So, how to edit the menu? Is edit items really the proper method to edit your menus from now on?

3 Answers

I believe that the MenuStrip editor experience difference comes down to .NET Core vs .NET Framework.

Edit: .NET 5 = .NET Core vNext

We covered MenuStrips while we were doing WinForms in my C# class and this exact question came up. .NET Framework solutions allow you to use the convenient editor as you have demonstrated. .NET Core solutions do not.

The easiest way I found to build out my MenuStrip items when in .NET Core was to click on the menu strip, then there is a property called "Items" which is a collection. In the properties pane, you can click the three dots button to bring up the Items Collection Editor: VS2019 Winforms .NET Core Items Collection Editor

Here you can create new ToolStripMenuItem objects to build your menu.

Possibly related post, others suggesting this is a Core vs Framework issue: MenuStrip not allowing to create menu

You might have used the option that says "Windows Forms App." This is wrong. You should use "Windows Forms App(.NET Framework)." This will let you edit the menuStrip control the easy way.

Related