Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Line Input erroneous eof()


Message #1 by "Dwaine Casmey" <dcasmey@f...> on Fri, 15 Nov 2002 23:13:38
I modified my input file to contain both chr(13) and chr(10) which worked 
for Readline property.  Unfortunately, it is doing the exact same thing... 
sometimes a few, sometimes all.  It has to be in my code somewhere else, 
perhaps a timer event or something.  I still like to use the scriping 
object better than line input, so I thank you!

Dwaine
> Dwaine,

Below is the code I use to do similar things; hope it helps.

Walt


Dim fso As New FileSystemObject
Dim ts As Textstream
Dim NrLines as Long
Dim cFileIn as String
Dim cCurrentLineData as string


Set TS = FSO.OpenTextFile(cFileIn)

' This will count the number of lines in the file
Do While Not TS.AtEndOfStream
   TS.ReadLine
   NrLines = NrLines + 1
Loop
TS.Close

'Now that you know how many lines are in the file,
'you can use ts.readline or ts.skipline as required to get to the line in 
the file you want.

Set ts = fso.OpenTextFile(cFileIn)

do while not ts.AtEndOfStream
   cCurrentLineData = ts.readline
   'insert your logic here
Loop
ts.close

set ts = nothing
set fso = nothing


  Return to Index