Microsoft® Visual Basic® Scripting Edition Line Property |
Scripting Run-Time Reference Version 2 |
Description
Read-only property that returns the current line number in a TextStream file.
Syntax
object.LineThe object is always the name of a TextStream object.
Remarks
After a file is initially opened and before anything is written, Line is equal to 1.The following example illustrates use of the Line property:
Function GetLine Const ForReading = 1, ForWriting = 2 Dim fso, f, ra Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile("c:\testfile.txt", ForWriting, True) f.Write "Hello world!" & vbCrLf & "VB Script is fun!" & vbCrLf Set f = fso.OpenTextFile("c:\testfile.txt", ForReading) ra = f.ReadAll GetLine = f.Line End Function