DesignSurface.CreateNestedContainer Method

Definition

Creates a container suitable for nesting controls or components.

Overloads

CreateNestedContainer(IComponent)

Creates a container suitable for nesting controls or components.

CreateNestedContainer(IComponent, String)

Creates a container suitable for nesting controls or components.

CreateNestedContainer(IComponent)

Source:
DesignSurface.cs
Source:
DesignSurface.cs
Source:
DesignSurface.cs

Creates a container suitable for nesting controls or components.

C#
public System.ComponentModel.INestedContainer CreateNestedContainer(System.ComponentModel.IComponent owningComponent);

Parameters

owningComponent
IComponent

The component that manages the nested container.

Returns

The nested container.

Exceptions

owningComponent is null.

The IDesignerHost attached to the DesignSurface has been disposed.

Remarks

Adding a component to a nested container creates its designer and makes it eligible for all services available from the design surface. Components added to nested containers do not participate in serialization.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

CreateNestedContainer(IComponent, String)

Source:
DesignSurface.cs
Source:
DesignSurface.cs
Source:
DesignSurface.cs

Creates a container suitable for nesting controls or components.

C#
public System.ComponentModel.INestedContainer CreateNestedContainer(System.ComponentModel.IComponent owningComponent, string containerName);
C#
public System.ComponentModel.INestedContainer CreateNestedContainer(System.ComponentModel.IComponent owningComponent, string? containerName);

Parameters

owningComponent
IComponent

The component that manages the nested container.

containerName
String

An additional name for the nested container.

Returns

The nested container.

Exceptions

owningComponent is null.

The IDesignerHost attached to the DesignSurface has been disposed.

Remarks

Adding a component to a nested container creates its designer and makes it eligible for all services available from the design surface. Components added to nested containers do not participate in serialization.

You can provide an additional name for the CreateNestedContainer method by passing a value into containerName.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10