Hello Terry,
I've not had call to walk over inner exceptions, however, if you really want
to, then you'll need to use a recursive function.
Private Function GetInnerException(byref tException As Exception) As String
Dim tReturn As String = String.Empty
If Not Nothing Is tException Then
tReturn = tException.ToString()
If Not Nothing Is tException.InnerException Then
tReturn = tReturn & GetInnerException(tException.InnerException)
End If
End If
Return tReturn
End Function
How can I walk through the InnerExceptions? Would the following code
be correct?
Private Sub ShowException(ByVal ex As Exception)
MsgBox(ex.Message)
If ex.InnerException Is Nothing = False Then _
ShowException(ex.InnerException)
End Sub
I thought I saw a snippet a while ago using a For...Each loop, but I'm
unable to find it again.
*** Sent via Developersdex http://www.developersdex.com ***