This documentation is archived and is not being maintained.

EditorAttribute Class

Specifies the editor to use to change a property. This class cannot be inherited.

Namespace:  System.ComponentModel
Assembly:  System (in System.dll)

<AttributeUsageAttribute(AttributeTargets.All, AllowMultiple := True, Inherited := True)> _
Public NotInheritable Class EditorAttribute _
	Inherits Attribute
Dim instance As EditorAttribute

When editing the property, a visual designer should create a new instance of the specified editor through a dialog box or drop-down window.

Use the EditorBaseTypeName property to find this editor's base type. The only available base type is UITypeEditor.

Use the EditorTypeName property to get the name of the type of editor associated with this attribute.

For general information on using attributes. see Attributes Overview and Extending Metadata Using Attributes. For more information on design-time attributes, see Attributes and Design-Time Support.

The following code example creates the MyImage class. The class is marked with an EditorAttribute that specifies the ImageEditor as its editor.

<Editor("System.Windows.Forms.ImageEditorIndex, System.Design", _
    GetType(UITypeEditor))> _
Public Class MyImage
    ' Insert code here. 
End Class 'MyImage

The following code example creates an instance of the MyImage class, gets the attributes for the class, and then prints the name of the editor used by myNewImage.

Public Shared Sub Main()
    ' Creates a new component. 
    Dim myNewImage As New MyImage()

    ' Gets the attributes for the component. 
    Dim attributes As AttributeCollection = TypeDescriptor.GetAttributes(myNewImage)

    ' Prints the name of the editor by retrieving the EditorAttribute 
    ' from the AttributeCollection.  

    Dim myAttribute As EditorAttribute = CType(attributes(GetType(EditorAttribute)), EditorAttribute)
    Console.WriteLine(("The editor for this class is: " & myAttribute.EditorTypeName))

End Sub 'Main


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

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0