LineNo Function | |
-- todo --
Returns the line number of a line being executed in a program relative to the first line of the main program.
Namespace:
XSharp.VFP
Assembly:
XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Syntax FUNCTION LineNo(
nPos
) AS LONG CLIPPER
[ClipperCallingConventionAttribute(new string[] { ... })]
public static int LineNo(
Usual nPos = default
)
Request Example
View SourceParameters
- nPos (Optional)
- Type: Usual
Returns the line number relative to the first line of the current program or procedure. If you omit the 1 argument,
the line number is returned relative to the first line of the main program.
Return Value
Type:
Long
Numeric
Remarks
Program lines are counted starting from the top of the program. Comment lines, continuation lines,
and blank lines are included in the line number count. If a program is suspended during execution,
LineNo( ) returns the number of the program line at which program execution was suspended.
LineNo( ) returns 0 if a program is canceled.
By default, line numbers are returned relative to the beginning of the main program. If a procedure is called,
line numbering continues from the top of the calling program.
LineNo( ) is useful for debugging programs. You can set a breakpoint to stop program execution at a specific line number
by opening the Breakpoints window, setting the Type to 'Break when expression is true'
and adding codeLineNo( ) = nExpression/code in the Expression textbox.
Examples 1On ERROR DO bug_proc WITH LineNo( )
2BRWS
3On ERROR
4*** Bug_Proc error handler ***
5PROCEDURE bug_proc
6PARAMETERS gnBadLine
7WAIT 'Error occurred at line: ' + ALLTRIM(STR(gnBadLine))
8RETURN
See Also