Public Shared ReadOnly Property IsInstalled() As Boolean
Get
Dim isInstalled As Boolean = False
Try
Dim temp as Object = CreateObject("Some.ActiveX")
isInstalled = True
Catch ex as Exception
End Try
Return isInstalled
End Get
End Property
If the COM object doesn't create properly, it will generate an exception. This sort of code is usually in the start up of an application, so you might have to hit this every time you debug your app. It's annoying.
However, if you add the handy attribute DebuggerStepThrough just before the Get clause:
Public Shared ReadOnly Property IsInstalled() As Boolean
<DebuggerStepThrough()> _
Get
Dim isInstalled As Boolean = False
Try
Dim temp as Object = CreateObject("Some.ActiveX")
isInstalled = True
Catch ex as Exception
End Try
Return isInstalled
End Get
End Property
Then Visual Studio just runs over the code like nothing ever happened.
No comments:
Post a Comment