Imports System.IO
Imports System.Diagnostics
Module Module1
Sub Main()
Dim Str As New FileStream("C:\DebugMessages.txt", System.IO.FileMode.Append)
Dim DebugFile As New StreamWriter(Str)
Dim Listener = New TextWriterTraceListener(DebugFile)
Debug.Listeners.Add(Listener)
Debug.AutoFlush = True
Debug.WriteLine("")
Debug.WriteLine("Messages generated at " & Now())
Debug.WriteLine("In Button Click")
Debug.WriteLine("Calling First")
First()
Debug.WriteLine("Exiting Button Click")
Debug.Listeners.Remove(Listener)
Str.Close()
End Sub
Private Sub First()
Debug.WriteLine("In First")
Debug.WriteLine("Calling Second")
Second()
Debug.WriteLine("Back in First")
End Sub
Private Sub Second()
Debug.WriteLine("In Second")
End Sub
End Module
|