you're looping until s is nothing. S will not become 'Nothing' just because it reaches the end of the line. Loop until s.EndOfStream instead.