Would you like to make this site your homepage? It's fast and easy...
Yes, Please make this my home page!
Private Sub DisplayExceptionArray()
Dim i As Long
Dim l As Long
Dim strErr As String
l = UBP1.aErrorList.GetUpperBound(1)
For i = 0 To l
strErr = strErr & UBP1.aErrorList(0, l) & vbCrLf '= ex.Message
strErr = strErr & UBP1.aErrorList(1, l) & vbCrLf '= ex.Source
strErr = strErr & UBP1.aErrorList(2, l) & vbCrLf '= ex.StackTrace
strErr = strErr & UBP1.aErrorList(3, l) & vbCrLf '= ex.GetType.ToString
strErr = strErr & UBP1.aErrorList(4, l) & vbCrLf '= ex.TargetSite.ToString
strErr = strErr & UBP1.aErrorList(5, l) & vbCrLf ' = ex.GetBaseException.GetType.ToString
strErr = strErr & UBP1.aErrorList(6, l) & vbCrLf ' = Now().ToString
strErr = strErr & vbCrLf
Next
TextBox1.Text = strErr
End Sub
Private Sub ShowException(ByVal e As Exception)
NextException = Nothing
Dim bNext As Boolean = False
With ListBox1.Items
'.Clear()
.Add("Type: " + e.GetType.ToString)
.Add("Source: " + e.Source)
.Add("TargetSite: " + e.TargetSite.ToString)
.Add("Message: " + e.Message)
'.Add("HelpLink: " + e.HelpLink)
.Add("Base Exception: " + e.GetBaseException.GetType.ToString)
.Add("StackTrace: " + e.StackTrace)
If Not (e.InnerException Is Nothing) Then
.Add("Inner Exception: " + e.InnerException.GetType.ToString)
.Add(" ")
.Add("----------------------------")
.Add(" ")
NextException = e.InnerException
bNext = True
Else
.Add("Inner Exception: NONE")
End If
End With
If bNext = True Then
ShowException(NextException)
End If
End Sub
Private Sub DisplayExceptionInfo(ByVal e As Exception)
' Display the error message.
ListBox1.Items.Add(" ")
ListBox1.Items.Add("+++++++++++++++++++++++")
ListBox1.Items.Add(" ")
ListBox1.Items.Add(e.Message)
Dim st As New StackTrace(e, True)
Dim i As Integer
For i = 0 To st.FrameCount - 1
' Get the i-th stack frame.
Dim sf As StackFrame = st.GetFrame(i)
' Get the corresponding method for that stack frame.
Dim mi As MemberInfo = sf.GetMethod
' Get the namespace where that method is defined.
Dim res As String = mi.DeclaringType.Namespace & "."
' Append the type name.
res &= mi.DeclaringType.Name & "."
' Append the name of the method.
res &= mi.Name
' Append information about the position in source file
' (but only if Debug information is available).
If sf.GetFileName <> "" Then
res &= " (" & sf.GetFileName & ", Line " & sf.GetFileLineNumber & _
", Col " & sf.GetFileColumnNumber
End If
' Append information about offset in MSIL code, if available.
If sf.GetILOffset <> StackFrame.OFFSET_UNKNOWN Then
res &= ", IL offset " & sf.GetILOffset.ToString
End If
' Append information about offset in native code.
res &= ", native offset " & sf.GetNativeOffset & ")"
ListBox1.Items.Add(res)
Next
End Sub
Private Sub DisplayExceptionInfo1(ByVal e As Exception)
' Display the error message.
ListBox1.Items.Add(" ")
ListBox1.Items.Add("+++++++++++++++++++++++")
ListBox1.Items.Add(" ")
ListBox1.Items.Add(e.Message)
Dim st As New StackTrace(e, True)
Dim i As Integer
For i = 0 To st.FrameCount - 1
' Get the i-th stack frame.
Dim sf As StackFrame = st.GetFrame(i)
' Get the corresponding method for that stack frame.
Dim mi As MemberInfo = sf.GetMethod
' Get the namespace where that method is defined.
Dim res As String = mi.DeclaringType.Namespace & "."
' Append the type name.
res &= mi.DeclaringType.Name & "."
' Append the name of the method.
res &= mi.Name
Dim objParameters() As ParameterInfo = sf.GetMethod.GetParameters()
Dim objParameter As ParameterInfo
Dim strParameterString As String = ""
strParameterString &= "("
For Each objParameter In objParameters
'Only add commas if there are more than one parameter
' (default length of 0 plus the opening parenthesis = 1).
If strParameterString.Length <> 1 Then
strParameterString &= ", "
End If
strParameterString &= objParameter.Name & " As " & _
objParameter.ParameterType.Name
Next
strParameterString &= ")"
res &= strParameterString
' Append information about the position in source file
' (but only if Debug information is available).
If sf.GetFileName <> "" Then
res &= " (" & sf.GetFileName & ", Line " & sf.GetFileLineNumber & _
", Col " & _
sf.GetFileColumnNumber
End If
' Append information about offset in MSIL code, if available.
If sf.GetILOffset <> StackFrame.OFFSET_UNKNOWN Then
res &= ", IL offset " & sf.GetILOffset.ToString
End If
' Append information about offset in native code.
res &= ", native offset " & sf.GetNativeOffset & ")"
ListBox1.Items.Add(res)
Next
End Sub