0

How do I know if I have reached the end of file using streamreader. My file has a lot of empty lines in it.

So if it try to use the following, its just stops wherever an empty line appears.

while ( Not line is Nothing) do.... end while  

thanks

Edited by happygeek: fixed formatting

2
Contributors
1
Reply
3
Views
7 Years
Discussion Span
Last Post by aldeene
0

well i'm using this code to get the last line of the textfile.. try playing with it

dim line as String
dim sr as StreamReader        
sr = File.OpenText(textfile)
        Do While sr.Peek() <> -1
            line = sr.ReadLine

        Loop
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.