Results 1 to 5 of 5

Thread: Line Numbers when reporting errors[Resolved]

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2002
    Posts
    90

    Line Numbers when reporting errors[Resolved]

    Is there a way to report the line number that an error occures when you are running a program. VB6 used ERL().
    Anyone know what to use VB.Net.
    Last edited by OUSoonerFan; Dec 1st, 2003 at 02:06 PM.

  2. #2
    Addicted Member Hole-In-One's Avatar
    Join Date
    Mar 2003
    Location
    Minnesota
    Posts
    195
    MsgBox(Err.Description)

    Will give you the description of the error and the line number

    Not sure about just the line number

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    VB Code:
    1. Try
    2.             Dim x As Integer = 1
    3.             Dim y As Integer = 0
    4.             Dim z As Integer = x / y
    5.         Catch ex As Exception
    6.             MsgBox(String.Format("Here is the whole stacktrace:{0}{1}", ControlChars.NewLine, ex.StackTrace), MsgBoxStyle.Critical)
    7.             'create a stacktrace object from the except to parse it
    8.             Dim st As New StackTrace(ex, True)
    9.             MsgBox(String.Format("Here is the just the line number:{0}{1}", ControlChars.NewLine, st.GetFrame(0).GetFileLineNumber), MsgBoxStyle.Critical)
    10.         End Try

  4. #4
    Addicted Member Hole-In-One's Avatar
    Join Date
    Mar 2003
    Location
    Minnesota
    Posts
    195
    I did a little searching and MS says that ERL is still supported in .net?

    See here:http://support.microsoft.com/default...b;en-us;311326


    So they say this should work

    MsgBox(Err.Erl)

    Hope that Helps!

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Sep 2002
    Posts
    90
    thanks for all the replies

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width