本文整理汇总了VB.NET中System.Type.GetTypeFromProgID方法的典型用法代码示例。如果您正苦于以下问题:VB.NET Type.GetTypeFromProgID方法的具体用法?VB.NET Type.GetTypeFromProgID怎么用?VB.NET Type.GetTypeFromProgID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Type 的用法示例。
在下文中一共展示了Type.GetTypeFromProgID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: MainApp
Class MainApp
Public Shared Sub Main()
Try
' Use the ProgID HKEY_CLASSES_ROOT\DirControl.DirList.1.
Dim myString1 As String = "DIRECT.ddPalette.3"
' Use a nonexistent ProgID WrongProgID.
Dim myString2 As String = "WrongProgID"
' Make a call to the method to get the type information of the given ProgID.
Dim myType1 As Type = Type.GetTypeFromProgID(myString1, True)
Console.WriteLine("GUID for ProgID DirControl.DirList.1 is {0}.", myType1.GUID.ToString())
' Throw an exception because the ProgID is invalid and the throwOnError
' parameter is set to True.
Dim myType2 As Type = Type.GetTypeFromProgID(myString2, True)
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
End Class
开发者ID:VB.NET开发者,项目名称:System,代码行数:20,代码来源:Type.GetTypeFromProgID
示例2: MainApp
Class MainApp
Public Shared Sub Main()
Try
' Use ProgID localhost\HKEY_CLASSES_ROOT\DirControl.DirList.1.
Dim theProgramID As String = "DirControl.DirList.1"
' Use Server name localhost.
Dim theServer As String = "localhost"
' Make a call to the method to get the type information for the given ProgID.
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
End Class
开发者ID:VB.NET开发者,项目名称:System,代码行数:20,代码来源:Type.GetTypeFromProgID
示例3: MainApp
Class MainApp
Public Shared Sub Main()
Try
' Use Server localhost.
Dim theServer As String = "localhost"
' Use ProgID HKEY_CLASSES_ROOT\DirControl.DirList.1.
Dim myString1 As String = "DirControl.DirList.1"
' Use a wrong ProgID WrongProgID.
Dim myString2 As String = "WrongProgID"
' Make a call to the method to get the type information for the given ProgID.
Dim myType1 As Type = Type.GetTypeFromProgID(myString1, theServer, True)
Console.WriteLine("GUID for ProgID DirControl.DirList.1 is {0}.", myType1.GUID.ToString())
' Throw an exception because the ProgID is invalid and the throwOnError
' parameter is set to True.
Dim myType2 As Type = Type.GetTypeFromProgID(myString2, theServer, True)
Catch e As Exception
Console.WriteLine("An exception occurred. The ProgID is wrong.")
Console.WriteLine("Source: {0}", e.Source.ToString())
Console.WriteLine("Message: {0}", e.Message.ToString())
End Try
End Sub
End Class
开发者ID:VB.NET开发者,项目名称:System,代码行数:22,代码来源:Type.GetTypeFromProgID
注:本文中的System.Type.GetTypeFromProgID方法示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论