Line Numbers in VB 
Author Message
 Line Numbers in VB

Does anyone know of a way to programmatically identify the source line
number of an error - or even the current line number - in a VB application?
I know I can get the project name from the Err object, but that doesn't help
much.  I'm willing to embed symbolic information, but I have not been able
to find any direct VB support to look up the line number from the debug
info.  I'm actually a C++ developer, so I'm willing to use voodoo or dark
magic if I need to.  I'm just looking for an obvious way in case I missed
something.  I have the sinking feeling I'm going to have to write a C++ DLL
to go wandering through the debug info and peek at the stack.

I'm working on a subsystem which automatically ports another flavor of
business BASIC to VB, and we need to be able to provide source module/line
number information for errors in order to avoid major changes to all of the
1500+ source modules we are porting.
--
Erick Kobres



Sun, 15 Oct 2000 03:00:00 GMT  
 Line Numbers in VB

Erick,

There is an undocumented variable VBA.Erl that stores line number of the
last error.
For details you could refer to the book 'Advanced Microsoft Visual Basic 5'
by TMS (Microsoft Press), Chapter 1, Tip 2.

Hope this helps.

Arthur



Quote:
> Does anyone know of a way to programmatically identify the source line
> number of an error - or even the current line number - in a VB
application?
> I know I can get the project name from the Err object, but that doesn't
help
> much.  I'm willing to embed symbolic information, but I have not been
able
> to find any direct VB support to look up the line number from the debug
> info.  I'm actually a C++ developer, so I'm willing to use voodoo or dark
> magic if I need to.  I'm just looking for an obvious way in case I missed
> something.  I have the sinking feeling I'm going to have to write a C++
DLL
> to go wandering through the debug info and peek at the stack.

> I'm working on a subsystem which automatically ports another flavor of
> business BASIC to VB, and we need to be able to provide source
module/line
> number information for errors in order to avoid major changes to all of
the
> 1500+ source modules we are porting.
> --
> Erick Kobres



Sun, 15 Oct 2000 03:00:00 GMT  
 Line Numbers in VB

That will do the trick.  Thanks very much.

-Erick

Quote:

>Erick,

>There is an undocumented variable VBA.Erl that stores line number of the
>last error.
>For details you could refer to the book 'Advanced Microsoft Visual Basic 5'
>by TMS (Microsoft Press), Chapter 1, Tip 2.

>Hope this helps.

>Arthur



>> Does anyone know of a way to programmatically identify the source line
>> number of an error - or even the current line number - in a VB
>application?
>> I know I can get the project name from the Err object, but that doesn't
>help
>> much.  I'm willing to embed symbolic information, but I have not been
>able
>> to find any direct VB support to look up the line number from the debug
>> info.  I'm actually a C++ developer, so I'm willing to use voodoo or dark
>> magic if I need to.  I'm just looking for an obvious way in case I missed
>> something.  I have the sinking feeling I'm going to have to write a C++
>DLL
>> to go wandering through the debug info and peek at the stack.

>> I'm working on a subsystem which automatically ports another flavor of
>> business BASIC to VB, and we need to be able to provide source
>module/line
>> number information for errors in order to avoid major changes to all of
>the
>> 1500+ source modules we are porting.
>> --
>> Erick Kobres



Sun, 15 Oct 2000 03:00:00 GMT  
 Line Numbers in VB

Quote:

>Does anyone know of a way to programmatically identify the source line
>number of an error - or even the current line number - in a VB application?

The now-undocumented ERL variable will tell you the last line number seen when the error occurred.  Note that you don't have to number _every_ line if you don't want to.  I use line numbers in larger procedures to narrow-down the source of the error if it might not be obvious otherwise.

Note that ERL was removed from the documentation with VB4 and could be removed from the language itself without any warning.

 /* MER */



Mon, 16 Oct 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Word '97 Line Number in VB 6.0

2. Line numbers and VB.NET

3. LINE NUMBERING IN VB

4. Word '97 Line Number from VB 6.0

5. Need tool to add line numbers to vb source

6. Line Numbers in VB IDE

7. line numbers in VB

8. line numbers in VB

9. line numbers in VB

10. PBM: Line numbers used by Goto method do not reflect displayed line numbers in document

11. Line numbers into multi-line text box

12. Numbering VB code lines

 

 
Powered by phpBB® Forum Software