Esempio n. 1
0
        //Handler to open a view question data form
        private void detailsButton_Click(object sender, EventArgs e)
        {
            Question tmpQuestion;

            //Make sure an object is selected and there is no form already open
            if (questionListBox.SelectedItem != null)
            {
                if (editQuestionForm == null || editQuestionForm.IsDisposed)
                {
                    //Downcast to a Question type
                    tmpQuestion         = questionListBox.SelectedItem as Question;
                    editedQuestionIndex = questionList.IndexOf(tmpQuestion);

                    //Pass a question to AddQuestion form constructor
                    editQuestionForm = new AddQuestion(tmpQuestion);
                    editQuestionForm.QuestionEdited +=
                        new AddNewQuestion(AddQuestion_QuestionEdited);
                    editQuestionForm.Show();
                }
            }
        }