Mega Code Archive

 
Categories / VB.Net / Reflection
 

Type GetTypeFromProgID gets type with program identifier (progID) from the specified server

Imports System Class MainApp     Public Shared Sub Main()         Try             Dim theProgramID As String = "DirControl.DirList.1"             Dim theServer As String = "localhost"             Dim myType As Type = Type.GetTypeFromProgID(theProgramID, theServer)             If myType Is Nothing Then                 Throw New Exception("Invalid ProgID or server.")             End If             Console.WriteLine("GUID for ProgID DirControl.DirList.1 is {0}.", myType.GUID.ToString())         Catch e As Exception             Console.WriteLine("An exception occurred.")             Console.WriteLine("Source: {0}.", e.Source.ToString())             Console.WriteLine("Message: {0}.", e.Message.ToString())         End Try     End Sub 'Main End Class 'MainApp