Hi Bob,
The following will give you the line number of your code (as in the source
file):
Dim CurrentStack As System.Diagnostics.StackTrace
MsgBox (CurrentStack.GetFrame(0).GetFileLineNumber)
In case you're interested, you can find out about the routine that you're
in as well as all its
callers.
Public Function MeAndMyCaller As String
Dim CurrentStack As New System.Diagnostics.StackTrace
Dim Myself As String = CurrentStack.GetFrame(0).GetMethod.Name
Dim MyCaller As String = CurrentStack.GetFrame(1).GetMethod.Name
Return "In " & Myself & vbCrLf & "Called by " & MyCaller
End Function
This can be very handy if you want a generalised error routine because it
can get the name of the caller (which would be where the error occurred).
Regards,
Fergus