Does this help
Imports System
Imports System.IO
Imports System.Diagnostics
Class Class1
Public Sub myMethod()
Throw New Exception("exception thrown on purpose")
End Sub
End Class
Module Module1
Sub Main()
Dim mClass As New Class1
Try
mClass.myMethod()
Catch e As Exception
' Display file and line information, if available.
Dim sf As New StackFrame(True)
Dim st As New StackTrace(sf)
Console.WriteLine(" StackTrace: " & st.ToString())
Console.WriteLine(" Line Number : " &
st.GetFrame(0).GetFileLineNumber())
Console.WriteLine("-------------------------------------------------")
Console.WriteLine(e.StackTrace)
Console.WriteLine("-------------------------------------------------")
End Try
End Sub
End Module