Public Sub DisplayForm(FormName as Variant, NumButtons as Variant) as String
On Error GoTo ErrHandler
mCallStack.Push 1, 1, "FormName: " + CStr(FormName) + "NumButtons: " + _
CStr(NumButtons)
' code to display form on browser with line numbers on all significant lines
ExitPoint:
mCallStack.Pop
Exit Sub
ErrHandler:
mCallStack.RunTimeError 1, 1, Err, Erl
Resume ExitPoint
End Sub
Figure 2 CallStack Sample
Dim mCallStack As CallStack2.clsCallStack
Public Sub Main()
20 Set mCallStack = New CallStack2.clsCallStack
40 mCallStack.Depth = 10
50 mCallStack.AppName = App.Title
60 mCallStack.ReportType = LogFile
70 mCallStack.LogFilePath = "error.log"
80 mCallStack.ModuleList = "Module1^"
90 mCallStack.ProcList = "Main^Proc1^Proc2^Proc3^"
110 mCallStack.InitStack
On Error GoTo ErrHandler
140 mCallStack.Push 1, 1
160 Proc1 "a", "b"
ExitPoint:
190 mCallStack.Pop
End
ErrHandler:
230 mCallStack.RunTimeError 1, 1, Err, Erl
Resume ExitPoint
End Sub
Private Sub Proc1(Param1 As String, _
Param2 As String)
On Error GoTo ErrHandler
280 mCallStack.Push 1, 2, "Param1: " + Param1 + ", Param2: " + Param2
300 Proc2 Param1, Param2
ExitPoint:
330 mCallStack.Pop
Exit Sub
ErrHandler:
370 mCallStack.RunTimeError 1, 2, Err, Erl
Resume ExitPoint
End Sub
Private Sub Proc2(Param1 As String, Param2 As String)
On Error GoTo ErrHandler
420 mCallStack.Push 1, 3, "Param1: " + Param1 + ", Param2: " + Param2
440 Proc3 Param1, Param2
ExitPoint:
470 mCallStack.Pop
Exit Sub
ErrHandler:
510 mCallStack.RunTimeError 1, 3, Err, Erl
Resume ExitPoint
End Sub
Private Sub Proc3(Param1 As String, Param2 As String)
Dim i As Integer
On Error GoTo ErrHandler
580 mCallStack.Push 1, 4, "Param1: " + Param1 + ", Param2: " + Param2
600 i = Param1 + Param2
ExitPoint:
630 mCallStack.Pop
Exit Sub
ErrHandler:
670 mCallStack.RunTimeError 1, 4, Err, Erl
Resume ExitPoint
End Sub
Figure 3 Contents of Error Log
03/07/1999 11:46:31 a RunTime Error in Project1
RunTime Error: 13 - Type mismatch
Module: Module1
Routine: Proc3
Line Number: 600
Call Stack:
Module: Module1 Procedure: Proc3(Param1: a, Param2: b)
Module: Module1 Procedure: Proc2(Param1: a, Param2: b)
Module: Module1 Procedure: Proc1(Param1: a, Param2: b)
Module: Module1 Procedure: Main()