What I am trying to do is read data from a CSV file located within a Windows application folder named "Attachments". In a web application you can get the path of the folder using
Server.MapPath(@"Attachments/sample.csv");
What is the equivalent call from a Windows application?
Below is my code.
string[] str = File.ReadAllLines(@"Attachment/sample.csv");
// create new datatable
DataTable dt = new DataTable();
// get the column header means first line
string[] temp = str[0].Split(';');
// creates columns of gridview as per the header name
foreach (string t in temp)
{
dt.Columns.Add(t, typeof(string));
}