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

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.