private void button2_Click(object sender, EventArgs e) { filePath = Application.StartupPath + "\\data\\" + metroTabPage1.Text; ProfileHelper.WriteExcel(dataGridView1, filePath); // XMLHelper.SaveXMLdata(filePath, dataGridView1); Change = false; }
private void btnOpen_Click(object sender, EventArgs e) { OpenFileDialog fd = new OpenFileDialog(); //首先根据打开文件对话框,选择excel表格 // fd.Filter = "|*--Cal.txt";//打开文件对话框筛选器 string strPath; //文件完整的路径名 if (fd.ShowDialog() == DialogResult.OK) { strPath = fd.FileName; ProfileHelper.ReadCal(strPath, ref dataGridView1, ref dataGridView2); } }
public FrmPrograms(string fa) { fileName = fa; InitializeComponent(); filePath = Application.StartupPath + "\\data\\" + fileName; if (File.Exists(filePath)) { ProfileHelper.ReadExcel(filePath, dataGridView1); // XMLHelper.ReadXMLdata(filePath, ref dataGridView1); } metroTabPage1.Text = fa; }
public FrmCalibration() { InitializeComponent(); addxyz(dataGridView1); addxyz(dataGridView2); string CalPath = Application.StartupPath + "\\data\\" + ModelsHelper.NowModels + "-cal.txt"; // string CalPath =$" {Application.StartupPath} //"; var res = ProfileHelper.ReadCal(CalPath, ref dataGridView1, ref dataGridView2); if (!res) { // Global.frmMain.PushMess($"{CalPath} not find"); } }
// string xml_FilePath = "";//用来记录当前打开文件的路径的 private void button1_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new System.Windows.Forms.OpenFileDialog();//一个打开文件的对话框 // openFileDialog1.Filter = "xml文件(*.xml)|*.xml";//设置允许打开的扩展名 try { if (openFileDialog1.ShowDialog() == DialogResult.OK)//判断是否选择了文件 { ProfileHelper.ReadExcel(openFileDialog1.FileName, dataGridView1); //XMLHelper.ReadXMLdata(openFileDialog1.FileName, ref dataGridView1); metroTabPage1.Text = Path.GetFileNameWithoutExtension(openFileDialog1.FileName); //openFileDialog1.FileName; } } catch (Exception) { throw; } }
private void btnSave_Click(object sender, EventArgs e) { string CalPath = Application.StartupPath + "\\data\\" + ModelsHelper.NowModels + "-cal.txt"; // string CalPath =$" {Application.StartupPath} //"; var s = ProfileHelper.WriteCal(dataGridView1, dataGridView2, CalPath);; }