Solved

Tracking any line of code that throws an error.

Posted on 2004-08-05
6
194 Views
Last Modified: 2012-05-05
Is there a way in VB6 to know exactly what line of code errored when the error handling is called?

Does VB track the line it is executing in a variable or something while it is processing. Something like a variable called strCodeExecuting that whenever on error is encountered I can write the variable out and know exactrly the line of code that was trying to be executed?

I want to keep a log of all errors, clients do not always tell me what the actual error was, or all the errors for that matter.

Thanks,
Mike
0
Comment
Question by:MGC22
  • 3
  • 2
6 Comments
 
LVL 6

Accepted Solution

by:
bkthompson2112 earned 50 total points
ID: 11729280
Hi MGC22,

You can use the undocumented erl() function to display the line number in your error log.

See here: http://www.awprofessional.com/articles/article.asp?p=25180

bkt
0
 
LVL 18

Assisted Solution

by:JR2003
JR2003 earned 50 total points
ID: 11730170
NB: To use the erl function you have to number all you lines of code
0
 

Author Comment

by:MGC22
ID: 11730215
I was hoping for the actual text of the line but the line number could work.
As JR2003 mentions about the line numbers, is there a way to automate putting in the line numbers in VB6?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 18

Expert Comment

by:JR2003
ID: 11742139
The source code for a vb add-in to add line numbers to code is here:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=49876&lngWId=1
0
 
LVL 18

Expert Comment

by:JR2003
ID: 11742143
In fact here's a better one and it's freeware!

www.mztools.com 
0
 
LVL 6

Expert Comment

by:bkthompson2112
ID: 11906803
Thanks :)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

821 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