private void button3_Click(object sender, EventArgs e) { if (lbSubjects.SelectedItem != null) { QuestionAddForm form = new QuestionAddForm(((Subject)lbSubjects.SelectedItem).ID); form.ShowDialog(); int selected = ((Subject)lbSubjects.SelectedItem).ID; dgvQuestions.DataSource = null; dgvQuestions.DataSource = controller.GetQuestions(selected); } }
private void bEdit_Click(object sender, EventArgs e) { if (dgvQuestions.CurrentRow != null) { if (lbSubjects.SelectedItem != null) { int selected = ((Subject)lbSubjects.SelectedItem).ID; var q = (Question)dgvQuestions.CurrentRow.DataBoundItem; QuestionAddForm form = new QuestionAddForm(selected, q, true); form.ShowDialog(); dgvQuestions.DataSource = null; dgvQuestions.DataSource = controller.GetQuestions(selected); } } }