Please note, this is a STATIC archive of website www.w3schools.com from 05 May 2020, cach3.com does not collect or store any user information, there is no "phishing" involved.
THE WORLD'S LARGEST WEB DEVELOPER SITE

ASP Line Property


❮ Complete TextStream Object Reference

The Line property returns the current line number in a TextStream file (starting at 1).


Syntax

TextStreamObject.Line

Example

<%
dim fs,f,t
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.CreateTextFile("c:\test.txt",true)
f.WriteLine("Hello World!")
f.WriteLine("How are you today?")
f.WriteLine("Goodbye!")
f.close

Set t=fs.OpenTextFile("c:\test.txt",1)
do while t.AtEndOfStream=false
  Response.Write("Line " & t.Line & ": ")
  Response.Write(t.ReadLine)
  Response.Write("<br>")
loop
t.Close
%>

Output:

Line 1: Hello World!
Line 2: How are you today?
Line 3: Goodbye!

❮ Complete TextStream Object Reference