コード例 #1
0
        private void NewToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var editForm = new EditQuestionForm();

            editForm.ShowDialog();
            if (editForm.DialogResult == DialogResult.OK)
            {
                test.Questions.Add(new Question(editForm.question));
                questionsBindingSource.ResetBindings(false);
            }
        }
コード例 #2
0
        private void Change()
        {
            if (!(OptionList.SelectedItem is Question item))
            {
                return;
            }
            int index    = test.Questions.IndexOf(item);
            var editForm = new EditQuestionForm(item);

            editForm.ShowDialog();
            if (editForm.DialogResult == DialogResult.OK)
            {
                test.Questions[index] = new Question(editForm.question);
                questionsBindingSource.ResetBindings(false);
            }
        }