private void 导入CSV文件ToolStripMenuItem_Click(object sender, EventArgs e) { if (DialogExcelDataLoad.ShowDialog() == DialogResult.OK) { ConstantMethod.SaveDirectoryByFileDialog(DialogExcelDataLoad); string localFilePath = DialogExcelDataLoad.FileName; string FileExt = Path.GetExtension(localFilePath).ToLower(); if (FileExt.Equals(Constant.CSVFileEX)) { UserDt = null; UserDt = csvop.OpenCSV1(DialogExcelDataLoad.FileName); if (UserDt != null && UserDt.Columns.Count > 3) { dgv.DataSource = UserDt; showColName(); } else { MessageBox.Show("加载文件错误!"); } } else { MessageBox.Show("文件格式错误!"); } } }