-
Oct 26th, 2021, 06:23 PM
#1
Thread Starter
Hyperactive Member
Detail from -- Catch ex As Exception
My code is such
Code:
Public Sub OpenConnection()
If (Me.con.State = ConnectionState.Closed) Then
Try
Me.con.Open()
Catch ex As Exception
Dim e = TryCast(ex, IContainsErrorRecord)
Dim message As String
If e IsNot Nothing Then
message = e.ErrorRecord.InvocationInfo.PositionMessage
Else
message = ex.Message
End If
Console.WriteLine(message)
MsgBox(ex.Message)
FailureOut = ex.Message
YesNo = True
End Try
End If
End Sub
I am wanting to get the MESSAGEDETAIL property but can't.
I'm using the Imports System.Management.Automation
Help please
Bill
Last edited by Shaggy Hiker; Oct 26th, 2021 at 08:00 PM.
Reason: Added CODE tags.
William E Gollnick
-
Oct 26th, 2021, 07:59 PM
#2
Re: Detail from -- Catch ex As Exception
If you want more information you can use "ex.ToString"
-
Oct 26th, 2021, 08:22 PM
#3
Thread Starter
Hyperactive Member
Re: Detail from -- Catch ex As Exception
Tried that but still could not see the data from the Messagedetail property. Thanks though. .it's closer.
-
Oct 27th, 2021, 12:50 PM
#4
Re: Detail from -- Catch ex As Exception
Have you checked the InnerException "ex.InnerException"?
-
Oct 27th, 2021, 02:55 PM
#5
Thread Starter
Hyperactive Member
Re: Detail from -- Catch ex As Exception
Originally Posted by KGComputers
Have you checked the InnerException "ex.InnerException"?
Yupper.. just tried that.... That itself errored and returned Nothing...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|