Implements a TextWriterTraceListener named myWriter to write to the console screen.
Imports System
Imports System.Management
Imports System.Diagnostics
Public Class Sample
Public Shared Sub Main()
Dim myWriter As New TextWriterTraceListener()
myWriter.Writer = System.Console.Out
Trace.Listeners.Add(myWriter)
myWriter.Write("this ")
myWriter.WriteLine(" is a test.")
' Flush and close the output.
myWriter.Flush()
myWriter.Close()
End Sub
End Class