private void editQuestionToolStripMenuItem_Click(object sender, EventArgs e) { if (questionListBox.SelectedItem == null) { MessageBox.Show("Select question for editing."); return; } selectedQuestion = (Question)questionListBox.SelectedItem; editForm = new EditQuestion(); editForm.Show(); editForm.PopulateData(selectedQuestion); editForm.QuestionUpdated += new EventHandler(this.EditForm_QuestionUpdated); }
private void editButton_Click(object sender, EventArgs e) { //edit the list if (questionListBox.SelectedItem == null) { MessageBox.Show("Please select the question.", "Error"); } else { Question tmpQuestion = (Question)questionListBox.SelectedItem; myEditForm = new EditQuestion(tmpQuestion); myEditForm.Show(); editIndex = questionList.IndexOf(tmpQuestion); currentListBoxIndex = questionListBox.SelectedIndex; myEditForm.UpdateQuestion += new QuestionEventHandle(this.QuestionUpdate); } }
private void questionListBox_DoubleClick(object sender, EventArgs e) { if (questionListBox.SelectedItem == null) { return; } // get the selected question from the list box Question selectedQuestion = (Question)questionListBox.SelectedItem; // create a new edit form editForm = new EditQuestion(); // show the form and set it to show details of the selected question //Wire the event handler editForm.Show(); editForm.PopulateData(selectedQuestion); editForm.QuestionUpdated += new EventHandler(this.EditForm_QuestionUpdated); }