Siebel VB Language Reference > VB Language Reference >
Erl Function
This standard VB function returns the line number where an error was trapped. Syntax
Erl
Returns
The line number on which an error occurred. Usage
If you use a Resume or On Error statement after Erl, the return value for Erl is reset to 0. To maintain the value of the line number returned by Erl, assign it to a variable. The value of the Erl function can be set indirectly through the Error statement. Example
This example prints the error number using the Err function and the line number using the Erl statement if an error occurs during an attempt to open a file. Siebel VB assigns line numbers, starting with 1, which is the Sub Button_Click statement. Sub Button_Click Dim msgtext, userfile On Error GoTo Debugger msgtext = "Enter the filename to use:" userfile = "c:\temp\trace.txt" Open userfile For Input As #1 ' ....etc.... Close #1 done: Exit Sub
Debugger: msgtext = "Error number " & Err & " occurred at line: " & Erl Resume done End Sub
Related Topics
Err Function Err Statement Error Function Error Statement On Error Statement Resume Statement Trappable Errors in Siebel VB
|