private void Properties(object sender, EventArgs e) { try { string filePath = dgv_exams.SelectedRows[0].Cells[1].Value.ToString(); Exam exam = Helper.GetExamFromFile(filePath); Exam_Properties properties = new Exam_Properties(exam, filePath); properties.ShowDialog(); } catch (FileNotFoundException) { MessageBox.Show("Sorry, the selected exam does not exist. It may have been moved or deleted.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Remove(sender, e); } catch (NullReferenceException) { MessageBox.Show("Sorry, the selected exam is not a supported version. You can convert it using the upgrade tool at:\n" + "https://sourceforge.net/projects/exam-upgrade-tool/", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Remove(sender, e); } }
private void btn_properties_Click(object sender, EventArgs e) { if (File.Exists(dgv_exams.SelectedRows[0].Cells[1].Value.ToString())) { Exam_Properties prop = new Exam_Properties(dgv_exams.SelectedRows[0].Cells[1].Value.ToString(), dgv_exams.SelectedRows[0].Cells[0].Value.ToString()); prop.ShowDialog(); } else { MessageBox.Show("Sorry, the selected file has been moved or deleted.", "Access error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); dgv_exams.Rows.Remove(dgv_exams.SelectedRows[0]); } }
private void btn_properties_Click(object sender, EventArgs e) { string fullFilePath = dgv_exams.SelectedRows[0].Cells[1].Value.ToString(); Exam_Properties prop = new Exam_Properties(fullFilePath, dgv_exams.SelectedRows[0].Cells[0].Value.ToString()); prop.ShowDialog(); }