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(); } }
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); }