Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Reading a text file one line at a time
At the top of my app I have a label control which will display a line of text. This will work like an ad-rotator but will only display text quotes. I want to list the quotes inside a text file e.g:
"Help yourself now"
"Get free now"
"Have a nice day"
When the user clicks on a button it will display the next quote. I've now idea how to do this. All I know is that I can use a FileStream object (fS) to access the Position property - this will give me the position of the stream (i.e. fS.Position) and I also know that I can get the length of the stream with the length property (i.e. fS.Length).
I think I should try and check how many lines are in the file but am unsure how to continue.
How can I complete the task? Please help. Many thanks.