InitializeComponent();
conDB = new csvfile();
conDB.Path = "E:\\BR_AttendanceDownloadLogs" +
DateTime.Today.ToString("yyyyMMdd") + ".csv";
fillCombo();
As beginner of programming and a very first time doing CRUD to a csv file in c#. I refer to this link:https://social.msdn.microsoft.com/Forums/en-US/27a98772-2dc6-4197-9f75-6cc119d4a88a/how-to-edit-a-line-from-a-text-file-using-c?forum=Vsexpressvcs that I've been located my source and useful to my program. But it was not satisfy to my specific satisfaction. I want to add header from it. Yes, I successfully added a header using this code.
String newFileName = "E:\\BR_AttendanceDownloadLogs" +
DateTime.Today.ToString("yyyyMMdd") + ".csv";
string clientHeader = "\"EmployeeCode\"" + ",\"" + "Date" + "\",\""+
"Time" + "\",\"" + "Type" + "\",\"" + "Remarks" + "\"" +
Environment.NewLine;
File.WriteAllText(newFileName, clientHeader);
conDB.InsertEntrie(txtidno.Text, DatePicker.Text, TimePicker.Text,
cmbtype.Text, txtremarks.Text);
//txtID.Text = Convert.ToString(conDB.Entries()-1);
txtvalue = Convert.ToString(conDB.Entries() - 1);
fillCombo();
txtidno.Text = "";
DatePicker.Text = "";
TimePicker.Text = "";
cmbtype.Text = "";
txtremarks.Text = "";
But after successfully added my header like this: "EmployeeCode","Date","Time","Type","Remarks" The flow of codes are infected by this type of field in the header. Note! I change the format just like what my header form. The rest of my function that reading the line in csv file is affected by my header.It return to undesirable error. Hope that anyone can rescue me to my Island of error.