Read a text file and pull out fields (comma delimeted)

SteveInBeloit

Well-known member
Joined
May 22, 2006
Messages
132
Programming Experience
10+
Hi,
I have a comma delimeted text file that I would like to read in and store the individule fields in arrays.
I have searched through the TextReader and BinaryReaders and can't quite come up with a way to do it.
Any thoughts?
Thanks,
Steve
 
You use a StreamReader to read text files. It has a ReadLine method to do the obvious and you can then use String.Split to spearate the values from the delimiters. If you look up the StreamReader class on MSDN it has links to topics dedicated to various I/O operations that include code examples.

By the way, had you searched MSDN for "read text file" (without quotes) you would have found this information fairly quickly. Get accustomed to using MSDN as quickly as possible because it should be a .NET developer's best friend.
 
Thanks for the information. I'm certainly not opposed to looking for more info anywhere I can find it. I had found the streamreader, and had it up and running, but I missed the split.
Thanks again,
Steve
 
Back
Top