VB source "FILE", "LINE" information

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
EnricoSAsked:
Who is Participating?
 
anthonycConnect With a Mentor Commented:
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
 
74wolfgangCommented:
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
 
EnricoSAuthor Commented:
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
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.