ProgIdAttribute Class
Allows the user to specify the ProgID of a class.
Assembly: mscorlib (in mscorlib.dll)
You can apply this attribute to classes.
ProgIDs are automatically generated for a class by combining the namespace with the type name. This can produce an invalid ProgID however, as ProgIDs are limited to 39 characters and can contain no punctuation other than a period. In such case, a ProgID can be manually assigned to the class using ProgIdAttribute.
The following example demonstrates how to apply ProgIdAttribute on a class. The application then gets all attributes of MyClass, and prints the Value property of ProgIdAttribute.
<ClassInterface(ClassInterfaceType.AutoDispatch), ProgId("InteropSample.MyClass")> _ Public Class [MyClass] Public Sub New() End Sub 'New End Class '[MyClass] Class TestApplication Public Shared Sub Main() Try Dim attributes As AttributeCollection attributes = TypeDescriptor.GetAttributes(GetType([MyClass])) Dim progIdAttributeObj As ProgIdAttribute = CType(attributes(GetType(ProgIdAttribute)), ProgIdAttribute) Console.WriteLine(("ProgIdAttribute's value is set to : " + progIdAttributeObj.Value)) Catch e As Exception Console.WriteLine(("Exception : " + e.Message.ToString())) End Try End Sub 'Main End Class 'TestApplication End Namespace 'InteropSample
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.