private void Start(object sender, EventArgs e) { try { string filePath = dgv_exams.SelectedRows[0].Cells[1].Value.ToString(); Exam exam = Helper.GetExamFromFile(filePath); Exam_Settings settings = new Exam_Settings(exam); settings.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_start_Click(object sender, EventArgs e) { if (File.Exists(dgv_exams.SelectedRows[0].Cells[1].Value.ToString())) { Exam_Settings sett = new Exam_Settings(dgv_exams.SelectedRows[0].Cells[1].Value.ToString(), dgv_exams.SelectedRows[0].Cells[0].Value.ToString()); sett.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_start_Click(object sender, EventArgs e) { string fullFilePath = dgv_exams.SelectedRows[0].Cells[1].Value.ToString(); Exam_Settings sett = new Exam_Settings(fullFilePath, dgv_exams.SelectedRows[0].Cells[0].Value.ToString()); sett.ShowDialog(); }