Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Tracking any line of code that throws an error.

Posted on 2004-08-05
6
Medium Priority
?
197 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 6

Accepted Solution

by:
bkthompson2112 earned 200 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 200 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

721 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