windows forms program
How to write a windows forms program that will allow the user to open and load the records of a comma delimited file?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Bhuvanesh MohankumarPosted May 10, 2016, 8:35 AM
Hi Sipho,
using System.IO;
static void Main(string[] args) listA = new List(); listB = new List();
{
var reader = new StreamReader(File.OpenRead(@"C:\test.csv"));
List
List
while (!reader.EndOfStream)
{
var line = reader.ReadLine();
var values = line.Split(';');
listA.Add(values[0]);
listB.Add(values[1]);
}
}
Mark as answer, if helpful.
Shakti Singh DulawatPosted May 10, 2016, 5:19 AM
var lines = File.ReadAllLines(pathToFile);