?
Solved

VB Error Object

Posted on 2005-05-06
5
Medium Priority
?
211 Views
Last Modified: 2010-05-02
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
0
Comment
Question by:hammadraza
  • 3
5 Comments
 
LVL 10

Expert Comment

by:PSSUser
ID: 13944379
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
 
LVL 10

Expert Comment

by:PSSUser
ID: 13944394
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
 
LVL 1

Author Comment

by:hammadraza
ID: 13944616
erl?
Is it a VB6 object?
0
 
LVL 10

Accepted Solution

by:
PSSUser earned 1000 total points
ID: 13944708
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
 
LVL 7

Expert Comment

by:Burbble
ID: 13948424
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

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question