This documentation is archived and is not being maintained.

ComponentEventArgs Class

Provides data for the ComponentAdded, ComponentAdding, ComponentRemoved, and ComponentRemoving events.

For a list of all members of this type, see ComponentEventArgs Members.

System.Object
   System.EventArgs
      System.ComponentModel.Design.ComponentEventArgs

[Visual Basic]
<ComVisible(True)>
Public Class ComponentEventArgs
   Inherits EventArgs
[C#]
[ComVisible(true)]
public class ComponentEventArgs : EventArgs
[C++]
[ComVisible(true)]
public __gc class ComponentEventArgs : public EventArgs
[JScript]
public
   ComVisible(true)
class ComponentEventArgs extends EventArgs

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Remarks

ComponentEventArgs is the root event arguments class for all component management events. This type of event occurs when you add or remove components using a designer.

Example

[Visual Basic, C#, C++] The following example demonstrates creating a ComponentEventArgs.

[Visual Basic] 
' This example method creates a ComponentEventArgs using the specified argument.
' Typically, this type of event args is created by a design mode subsystem.  
Public Function CreateComponentEventArgs(ByVal component As IComponent) As ComponentEventArgs

    Dim args As New ComponentEventArgs(component)

    ' The component that is related to the event:  args.Component

    Return args
End Function

[C#] 
// This example method creates a ComponentEventArgs using the specified argument.
// Typically, this type of event args is created by a design mode subsystem.  
public ComponentEventArgs CreateComponentEventArgs(IComponent component)
{
    ComponentEventArgs args = new ComponentEventArgs(component);

    // The component that is related to the event:  args.Component

    return args;
}

[C++] 
// This example method creates a ComponentEventArgs using the specified argument.
// Typically, this type of event args is created by a design mode subsystem.
ComponentEventArgs* CreateComponentEventArgs(IComponent* component)
{
    // The component that is related to the event:  args.Component

    return new ComponentEventArgs(component);
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.ComponentModel.Design

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System (in System.dll)

See Also

ComponentEventArgs Members | System.ComponentModel.Design Namespace | ComponentEventHandler | IComponentChangeService

Show: