想要创建一个不带任何列标题和引号的读取和编辑csv文件的应用程序。 我已编码最大部分,但它 测试没有标题的文件时出错。
private void LoadFile(string filePath)
{
Arguments arg = new Arguments();
arg.Task = Work.task_open;
arg.Add(BackgroundWorkArgumentKeys.openfile, filePath);
arg.Add(BackgroundWorkArgumentKeys.setFirstRowAsHeader, true);
this.grid.Enabled = false;
this._BackgroundWorker.RunWorkerAsync(arg);
}
private void LoadFile()
{
this.LoadFile(this.grid.CurrentFilePath);
}
private void SaveFile(string filePath)
{
this.UpdateDataSource();
Arguments arg = new Arguments();
arg.Task = Work.TASK_SAVE;
arg.Add(BackgroundWorkArgumentKeys.savefilepath, filePath);
arg.Add(BackgroundWorkArgumentKeys.savedatasource, (DataTable)this.grid.DataSource);
arg.Add(BackgroundWorkArgumentKeys.setFirstRowAsHeader, true);
this.grid.Enabled = false;
this._BackgroundWorker.RunWorkerAsync(arg);
}