private void Form2_Load(object sender, EventArgs e) { if (File.Exists(CauHinh.docfile()[0]) == true) { progressBar1.Hide(); dex = new Data_Excel(ClConnect.connect(CauHinh.docfile()[0])); dataHienThi.DataSource = dex.getDataTable("select [KyHieu],[YNghia] from [KyHieu$] where [KyHieu]<>''"); toolduongdan.Text = CauHinh.docfile()[0]; heuristicToolStripMenuItem.Checked = true; lbTheo.Text = "Theo Heuritic"; textBox1.Text = "Fe,H2SO4"; textBox2.Text = "SO2"; rtSuyDien.ReadOnly = true; } else { this.Show(); if (MessageBox.Show("Lỗi không tìm thấy tập dữ liệu \n Chọn tập tin", "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error) == DialogResult.OK) { Form1 t = new Form1(); t.ShowDialog(); if (MessageBox.Show("Khởi động lại ứng dụng", "Thông tin", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK) { Application.Restart(); } } else { Application.Exit(); } } strsave = new List <string>(); }
private void textBox1_Click(object sender, EventArgs e) { textBox1.Text = ""; openFileDialog1.FileName = ""; openFileDialog1.Filter = "Excel_2003|*.xls|Excel_2007|*.xlsx"; openFileDialog1.ShowDialog(); filename = openFileDialog1.FileName; if (openFileDialog1.FileName.Length != 0) { cauhinh = new string[2]; cauhinh[0] = openFileDialog1.FileName; if (getVision(openFileDialog1.FileName) == true) { cauhinh[1] = 0 + ""; } else { cauhinh[1] = 1 + ""; } textBox1.Text = filename; CauHinh.ghifile(cauhinh); khoa(true); System.Windows.Forms.Application.Restart(); } else if (MessageBox.Show("Khong chon duoc tap tin", "Error", MessageBoxButtons.OK) == DialogResult.OK) { khoa(false); System.Windows.Forms.Application.Exit(); } }
public ThuatToan(string giathiet, string ketluan) { connect = ClConnect.connect(CauHinh.docfile()[0]); dex = new Data_Excel(connect); tapluat = new List <string>(); this.giathiet = converStringToArray(giathiet, ','); this.ketluan = ketluan; luat = getTapLuat(); vet = new List <string>(); tapgiathiet = new List <string>(); }
private void Form1_Load(object sender, EventArgs e) { if (File.Exists(CauHinh.docfile()[0]) == true) { loadData(); } else { khoa(false); } }
public static OleDbConnection connect(string name) { if (CauHinh.docfile()[1].CompareTo("0") == 0) { return(new OleDbConnection(stringconnectxls1 + name)); //connect file excel 2003; } return(new OleDbConnection(stringconnectxls2 + name)); //connect file excel 2007; return(new OleDbConnection(stringconnectxls3 + name)); //connect file excel 2010; return(new OleDbConnection(stringconnectxls4 + name)); //connect file excel 2013; }
private void saveFileDialog1_FileOk(object sender, CancelEventArgs e) { strsave.Clear(); strsave.Add("Gia thiết: " + textBox1.Text); strsave.Add("Kết luận: " + textBox2.Text); strsave.Add("Theo luật: " + lbTheo.Text); strsave.Add("Suy Diễn: "); string [] temp = rtSuyDien.Text.Split('*'); for (int i = 0; i < temp.Length; i++) { strsave.Add(temp[i]); } file = new FileStream(saveFileDialog1.FileName, FileMode.Create); CauHinh.ghifile(strsave, file); }