VB Error Object

Hi everyone!
    Is there any way that i can get the line number where last error has occured in an ActiveX Dll. i m calling that dll from an ASP page. i have look into "err" object but it provides description and some other properties but not the line number.

Thanks,
Hammad
LVL 1
hammadrazaAsked:
Who is Participating?
 
PSSUserConnect With a Mentor Commented:
It's more like a vb variable.

In the dll you will need to pass the value of erl into a variable the ASP page can access.
For example you could create a dll function to return the erl or raise an error from within the dll that includes the line number.
For example:
Err.Raise Err.Number, "MyDll.SomeFunction", Err.Description & " at line " & Erl
0
 
PSSUserCommented:
To get the line number you need to use erl.

In order for erl to contain the line number, you need to add line numbering to each line of code in the dll. There are numerous free tools (VB addins) that will add the line numbering for you.
0
 
PSSUserCommented:
Here is a link to a line numbering tool (plus it has a load of other functionality):
http://www.mztools.com/v3/mztools3.htm
0
 
hammadrazaAuthor Commented:
erl?
Is it a VB6 object?
0
 
BurbbleCommented:
Here's a brief example:

Private Sub Form_Load()
    On Error GoTo err

1:     Me.Caption = 5 / 5
2:     Me.Caption = 5 / 4
3:     Me.Caption = 5 / 3
4:     Me.Caption = 5 / 2
5:     Me.Caption = 5 / 1
6:     Me.Caption = 5 / 0

    Exit Sub
err:
    MsgBox "Error " & err.Number & ": " & err.Description & vbNewLine & "Line #: " & erl
End Sub
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.