This documentation is archived and is not being maintained.

ToolStripManager.Merge Method (ToolStrip, String)

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
)

Parameters

sourceToolStrip
Type: System.Windows.Forms.ToolStrip
The ToolStrip to be combined with the ToolStrip referred to by the targetName parameter.
targetName
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.

ExceptionCondition
ArgumentNullException

The sourceToolStrip or targetName parameter is null.

ArgumentException

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.

NoteNote

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

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: