Using streamreader to load an array

titancompu

New member
Joined
Apr 25, 2008
Messages
1
Programming Experience
1-3
I'm working on a class assignment in object orientated programming in VB.net. I've come across a set of instructions that I'm not sure how to code. I'm supposed to create a textfile with a list of 12 prices in it, then use a Streamreader to load a six row and two column array with the prices from the file. I have to do the loading on the formload of the main form. Conceptually, I know that I have to use the streamreader to load the file and that it has to be dimmed, and a loop would be involved in the loading, but I'm lost as to how to actually code it. Any help would be GREATLY appreciated.
 
OK, have you read the documentation for the StreamReader class, including its member listing? That is ALWAYS the place to start. There's no guarantee that you'll understand everything you read but you'll definitely know more than when you started. You'll see what members the class has, as well as code examples of their use. The StreamReader class topic also has links in the See Also session to general I/O topics, including "How To: Read From a Text File". Sound useful?

I'll give you a couple of clues. You'll definitely want to use the EndOfStream property to determine when you get to the end of the file. Also, you'll want to use the ReadLine method to read the data one line at a time. You'll want to use those members with a Do or While loop.
 
Back
Top