CSV file is nothing but the text file with comma delimiter. "," will be used to seperate each field
first add the namespace system.io
the code is
string line;
try
{
using (StreamReader sr = new StreamReader("configuration.ini"))
{
line = sr.ReadLine();
while (line != null)
{
line = sr.ReadLine();
string [] split = null;
{
split = line.Split(',');
//do ur validation and code here based on the array count in split
}
}
}
catch ()
{
MessageBox.Show("Cannot read from the file");
}
No comments:
Post a Comment