private void button5_Click(object sender, EventArgs e) { string strFile_jisuancanshu = ""; OpenFileDialog ofd = new OpenFileDialog(); ofd.InitialDirectory = "D:\\开题\\shuju"; //ofd.Filter = "Excel文件(*.xls;*.xlsx)|*.xls;*.xlsx|所有文件|*.*"; ofd.ValidateNames = true; ofd.CheckPathExists = true; ofd.CheckFileExists = true; //strFileA_xishu = "D:\\开题\\shuju\\20120712_20m+\\1000\\2012-07-12-10_56_36.txt "; if (ofd.ShowDialog() != DialogResult.OK) { MessageBox.Show("请选择数据文件"); // return; } strFile_jisuancanshu = ofd.FileName; ps5000example.ExcelHelp excelhelp = new ExcelHelp(); //MessageBox.Show("您当前选择数据为" + strFileName8.ToString()); Jisuancanshu = excelhelp.LoadDataFromExcel(strFile_jisuancanshu); JisuancanshuFor_1_3 = excelhelp.LoadDataFromExcel_sheel2(strFile_jisuancanshu); if (Jisuancanshu != null && JisuancanshuFor_1_3 != null) { MessageBox.Show("读取数据成功"); } }