Solved

VB source "FILE", "LINE" information

Posted on 1998-07-02
3
281 Views
Last Modified: 2008-03-10
In "C" you can use __FILE__ and __LINE__ to let the precompiler insert the source filename and source linenumber in that spot in your code. Does VB have something similar ??
I want to write a generic "Error logging" function that includes this information in the error entry. On the call to the LogError function I want to include the source filename and the line number (or at maybe the current function or sub name ?).
eg.
Call LogError(__FILE__, __LINE__, some, other, parms)
I do not want to hardcode the source file name & line number. I would hate to start numbering lines or write an Add-In to do this
0
Comment
Question by:EnricoS
3 Comments
 
LVL 6

Accepted Solution

by:
anthonyc earned 120 total points
Comment Utility
VB Does not allow for this.  The file name problem is out of the question.  I wrote an Addin to handle the filename problem.  As far as the line numbering is concerned, you will have to number lines.  Once you number lines, you can use the undocumented variable called ERL to get the line number where the error occured.
0
 

Expert Comment

by:74wolfgang
Comment Utility
i´m not sure but look out for listbox, listcount and listindex in the vb helpfile or MSDN.
line input

hope this help a bit

bye
0
 

Author Comment

by:EnricoS
Comment Utility
Somewhat disgusting !!! Any hope that VB 6 will have this ?? (or that the guys at Microsoft reads this & add it to a later version ??)
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now