Uređivanje

Dijeli putem


IDesignerHost.CreateComponent Method

Definition

Creates a component of the specified type and adds it to the design document.

Overloads

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.

CreateComponent(Type)

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

CreateComponent(Type, String)

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