private void button1_Click(object sender, EventArgs e) { OpenFileDialog fdlg = new OpenFileDialog(); fdlg.Title = "Select file"; //fdlg.InitialDirectory = @"c:\"; fdlg.FileName = txtFileName.Text; fdlg.Filter = "Excel Sheet(*.xls)|*.xls|All Files(*.*)|*.*"; fdlg.FilterIndex = 1; fdlg.RestoreDirectory = true; //if (fdlg.ShowDialog() == DialogResult.OK) if (true) { txtFileName.Text = fdlg.FileName; ef = new ExFunc("金融产品销售系统_详细设计说明书_上海大宗交易.xls"); //ef.ReadExcel2(); ef.ReadExcel(); //dgv1.DataSource = ef.ds.Tables[0]; //int s = int.Parse(dgv1.Rows[1].Cells[5].Value.ToString(), NumberStyles.Integer); //dgv1.Rows[1].Cells[5].Style.Format = "N"; //Application.DoEvents(); ef.ReadFuncList(); ef.SetParaTable(); foreach (Func f in ef.FuncList) { lstFunc.Items.Add(f.ObjectNo); } // 读取第二个 Excel ef1 = new ExFunc("金融产品销售系统_详细设计说明书_上海大宗交易1.xls"); //ef.ReadExcel2(); ef1.ReadExcel(); //dgv1.DataSource = ef.ds.Tables[0]; //int s = int.Parse(dgv1.Rows[1].Cells[5].Value.ToString(), NumberStyles.Integer); //dgv1.Rows[1].Cells[5].Style.Format = "N"; //Application.DoEvents(); ef1.ReadFuncList(); ef1.SetParaTable(); } }