Results 1 to 5 of 5

Thread: Detail from -- Catch ex As Exception

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Hendersonville , NC
    Posts
    260

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width