ToolStripManager.Merge Method (ToolStrip, String)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Combines two ToolStrip objects of the same type.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public static bool Merge(
	ToolStrip sourceToolStrip,
	string targetName


Type: System.Windows.Forms.ToolStrip

The ToolStrip to be combined with the ToolStrip referred to by the targetName parameter.

Type: System.String

The name of the ToolStrip that receives the ToolStrip referred to by the sourceToolStrip parameter.

Return Value

Type: System.Boolean

true if the merge is successful; otherwise, false.

Exception Condition

The sourceToolStrip or targetName parameter is null.


The sourceToolStrip or targetName parameters refer to the same ToolStrip.

Use the ToolStripManager.Merge method to combine ToolStrip objects of identical type, such as ToolStrip objects with other ToolStrip objects, MenuStrip objects with other MenuStrip objects, and so on.

Use the ToolStripManager.Merge method to combine ToolStrip objects of different types.

The ToolStrip.AllowMerge property must be set to true for both ToolStrip objects, and the source and target types must be identical, or this method returns false.


If there are two MenuStrip controls on an MDI child form, setting IsMdiContainer to true for the parent form merges the contents of only one of the MenuStrip controls. Use Merge to merge the contents of additional child MenuStrip controls on the MDI parent form.

.NET Framework
Available since 2.0
Return to top