Name
Erl Property
Class
Microsoft.VisualBasic.Information
Syntax
Erl
Return Value
An Integer containing the line number
Description
Indicates the line number on which an error occurred
Rules at a Glance
Erl
returns the line number only if one has been provided in the source code.If the error occurs on a line that does not have a line number,
Erl
returns 0.
Programming Tips and Gotchas
Erl
is not affected by compiler settings. Compiling with the /debug- switch does not preventErl
from accurately reporting the line number.Line numbers are rarely used in modern VB code. In VB.NET, line numbers are labels that must be followed by a colon.
Although programmers have been requesting an error-handling function that reports the line number on which an error occurred,
Erl
has one major limitation: namely, it requires that the developer assign a line number to source code lines in advance.Erl
is not new to VB .NET. It was an undocumented and little known function in previous versions of Visual Basic (and of QBasic as well).
VB .NET/VB 6 Differences
In VB 6, line numbers are distinct from labels, and do not require that any symbol (other than white space) separate them from that their lines’ source code. In VB .NET, line numbers are labels that must be followed by a colon.
Get VB .NET Language in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.