IDesignerHost.CreateComponent Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates a component of the specified type and adds it to the design document.
CreateComponent(Type) |
Creates a component of the specified type and adds it to the design document. |
CreateComponent(Type, String) |
Creates a component of the specified type and name, and adds it to the design document. |
Creates a component of the specified type and adds it to the design document.
public:
System::ComponentModel::IComponent ^ CreateComponent(Type ^ componentClass);
public System.ComponentModel.IComponent CreateComponent(Type componentClass);
abstract member CreateComponent : Type -> System.ComponentModel.IComponent
Public Function CreateComponent (componentClass As Type) As IComponent
Parameters
- componentClass
- Type
The type of the component to create.
Returns
The newly created component.
Remarks
If the type cannot be resolved into an object that implements IComponent, an exception is thrown.
This method does not specify a name for the component. The method creates the component and adds it to the designer container.
See also
Applies to
.NET 10 and other versions
Product | Versions |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 1.1, 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 |
.NET Standard | 2.0, 2.1 |
Creates a component of the specified type and name, and adds it to the design document.
public:
System::ComponentModel::IComponent ^ CreateComponent(Type ^ componentClass, System::String ^ name);
public System.ComponentModel.IComponent CreateComponent(Type componentClass, string name);
abstract member CreateComponent : Type * string -> System.ComponentModel.IComponent
Public Function CreateComponent (componentClass As Type, name As String) As IComponent
Parameters
- componentClass
- Type
The type of the component to create.
- name
- String
The name for the component.
Returns
The newly created component.
Remarks
If the type cannot be resolved into an object that implements IComponent, an exception is thrown.
This method creates the component and adds it to the designer container.
See also
Applies to
.NET 10 and other versions
Product | Versions |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 1.1, 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 |
.NET Standard | 2.0, 2.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: