Which function can be used to trap the line number causing error?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: Which function can be used to trap the line number causing error?

  1. #1
    Ken Guest

    Which function can be used to trap the line number causing error?


    Hi,

    I want to trap the line number at which the run-time error happens. Which
    function can be used for that purpose? Thanks!

  2. #2
    ken Guest

    Re: Which function can be used to trap the line number causing error?


    Bob,

    Thanks! Where can I find the difinition of Erl function? I didn't find it
    in MSDN help file for VB.

    "Bob Butler" <butlerbob@earthlink.net> wrote:
    >"Ken" <kzhao@calltrol.com> wrote in message news:3b13a8ec$1@news.devx.com...
    >> I want to trap the line number at which the run-time error happens. Which
    >> function can be used for that purpose? Thanks!

    >
    >Erl
    >
    >but only if you have put line numbers in your code
    >
    >
    >



  3. #3
    Bob Butler Guest

    Re: Which function can be used to trap the line number causing error?

    "Ken" <kzhao@calltrol.com> wrote in message news:3b13a8ec$1@news.devx.com...
    > I want to trap the line number at which the run-time error happens. Which
    > function can be used for that purpose? Thanks!


    Erl

    but only if you have put line numbers in your code




  4. #4
    Bob Butler Guest

    Re: Which function can be used to trap the line number causing error?


    "ken" <kzhao@calltrol.com> wrote in message news:3b13ac9f@news.devx.com...
    > Thanks! Where can I find the difinition of Erl function? I didn't find it
    > in MSDN help file for VB.


    I'm not sure; it was in the VB3 help files but that's probably the last time
    I ever saw it. I've never used the function. I found some info at:
    http://support.microsoft.com/support.../Q148/3/58.asp




  5. #5
    Arthur Wood Guest

    Re: Which function can be used to trap the line number causing error?


    Ken,

    Erl is NOT a function, but rather a GLOBAL value which is set by the
    internal Error function, which is called when an error is detected. It is
    set to the line number where the error occured (if you have actually coded
    line numbers in you VB code). If you have not assigned line numbers, then
    it will return O(the value zero).

    so if you code reads:

    Dim x As Integer, y As Integer, z As Integer
    On Error GoTo myHandler
    100: x = x + y
    120: z = x / 0
    Exit Sub
    myHandler:
    MsgBox "Error: " & Err.Number & " " & Err.Description & " occurred at
    line " & Erl


    would generate this MsgBox:

    Error: 6 Overflow occurred at line 120

    Erl is a built in value that you can access automaticaally.

    Arthur Wood
    "ken" <kzhao@calltrol.com> wrote:
    >
    >Bob,
    >
    >Thanks! Where can I find the difinition of Erl function? I didn't find it
    >in MSDN help file for VB.
    >
    >"Bob Butler" <butlerbob@earthlink.net> wrote:
    >>"Ken" <kzhao@calltrol.com> wrote in message news:3b13a8ec$1@news.devx.com...
    >>> I want to trap the line number at which the run-time error happens. Which
    >>> function can be used for that purpose? Thanks!

    >>
    >>Erl
    >>
    >>but only if you have put line numbers in your code
    >>
    >>
    >>

    >



  6. #6
    George Lissauer Guest

    Re: Which function can be used to trap the line number causing error?

    You can use VB Builder to add line numbers to your code
    The help file includes Microsoft's help on the Erl function which
    gives the line number of the error. Try VB Builder at
    http://www.gridlinx.com
    ....
    George
    GridLinx Software Programming Tools for VB Programmers

    Ken wrote in message <3b13a8ec$1@news.devx.com>...
    >
    >Hi,
    >
    >I want to trap the line number at which the run-time error happens. Which
    >function can be used for that purpose? Thanks!




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center