Solved

VB source "FILE", "LINE" information

Posted on 1998-07-02
3
294 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
ID: 1464799
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
ID: 1464800
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
ID: 1464801
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

730 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