Cannot use ToolStripContainer in .NET 5.0

197 Views Asked by At

I need to create toolstrip on the left. But toolbox have not any ToolStripContainer.

enter image description here

So I try to add manually a ToolStripContainer by coding at a design file. But a ToolStripContainer is drawn by a red cross.

 Private Sub InitializeComponent()
      Me.toolStripContainer1 = New System.Windows.Forms.ToolStripContainer()
      Me.SuspendLayout()
      Me.toolStripContainer1.Size = New System.Drawing.Size(635, 407)
      Me.toolStripContainer1.TabIndex = 0
      Me.toolStripContainer1.Text = "ToolStripContainer1"

      Me.Controls.Add(Me.toolStripContainer1)
      Me.toolStripContainer1.LeftToolStripPanel.ResumeLayout(False)
      Me.toolStripContainer1.LeftToolStripPanel.PerformLayout()
      Me.ResumeLayout(False)
      Me.PerformLayout()
 End Sub 

Can I use ToolStripContainer in .Net 5.0

1

There are 1 best solutions below

0
Caius Jard On

Microsoft seem to advocate continuing to use the winforms designer from .net framework - in essence you should have two projects, a .NET framework one that you do the form design in and a .NET core/5 one that you "add existing item" the forms to so they compile and work (but you design them in the other project/have two VS open)

See https://github.com/dotnet/winforms/blob/main/docs/winforms-designer.md for more info