954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Streamreader End of File

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.

[code] while ( Not line is Nothing) do.... end while [code]

thanks

crazycode300
Newbie Poster
3 posts since Aug 2011
Reputation Points: 10
Solved Threads: 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
aldeene
Junior Poster in Training
70 posts since Jul 2011
Reputation Points: 10
Solved Threads: 3
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: