Why do you need this??? And can't you copy/paste the output from Visual Studio to a text file manually???
I don't have or know vb 2003 but use the Try Catch. Under the catch send the error to your log file.
Imports System.IO Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim x, y As Integer y = 0 Try x = 5 / y Catch ex As Exception Dim writer As New StreamWriter("C:\MyLog.log", True, System.Text.Encoding.ASCII) writer.WriteLine(ex.Message) writer.Close() End Try End Sub End Class
There is also a way you can write the exceptions to your Event Logs if that comes in handy.
If you're trying to use this to debug, you might want to use something like.
Catch ex as Exception