Home All Groups Group Topic Archive Search About

(newbie -vb2005) going back to begin of file with StreamReader

Author
28 Sep 2006 9:40 AM
Opa Vito
Hello,

I do a reading of a file with a StreamReader, reading line after line.
How do I force the reader to go back to the beginning of the file and
start reading again (or go to a specified line) when it reaches the end
of the file?

Thanks

Opa Vito

Author
28 Sep 2006 11:47 AM
Herfried K. Wagner [MVP]
"Opa Vito" <gebr***@dit.niet> schrieb:
> I do a reading of a file with a StreamReader, reading line after line.
> How do I force the reader to go back to the beginning of the file and
> start reading again (or go to a specified line) when it reaches the end of
> the file?

'Reader.BaseStream.Position', for example.  Check out the stream's 'Seek'
method too.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>
Author
28 Sep 2006 5:16 PM
Opa Vito
Herfried K. Wagner [MVP] schreef:
> "Opa Vito" <gebr***@dit.niet> schrieb:
>
>> I do a reading of a file with a StreamReader, reading line after line.
>> How do I force the reader to go back to the beginning of the file and
>> start reading again (or go to a specified line) when it reaches the
>> end of the file?
>
>
> 'Reader.BaseStream.Position', for example.  Check out the stream's
> 'Seek' method too.
>

Thank you.

Vito