コード例 #1
0
        private void btnAddMultiple_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(cmbGrades.Text))
            {
                MessageBox.Show("Grade can't be blank!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else if (string.IsNullOrEmpty(cmbSubjects.Text))
            {
                MessageBox.Show("Subjec can't be blank!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else if (string.IsNullOrEmpty(cmbTopicNo.Text))
            {
                MessageBox.Show("Topic can't be blank!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                pnlQuestions.Controls.Clear();
                if (rdbMultiple.Checked)
                {
                    int numberOfOptions = Convert.ToInt32(txtOptionsNumeric.Value);
                    AddMultipleQuestions addMultipleQuestions = new AddMultipleQuestions();
                    addMultipleQuestions.numerOfOptions = numberOfOptions;

                    addMultipleQuestions.TopLevel = false;
                    pnlQuestions.Controls.Add(addMultipleQuestions);
                    addMultipleQuestions.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                    addMultipleQuestions.Dock            = DockStyle.Fill;
                    addMultipleQuestions.Show();
                }
                else if (rdbTF.Checked)
                {
                    AddTrueFalseQuestion addTrueFalse = new AddTrueFalseQuestion();
                    addTrueFalse.TopLevel = false;
                    pnlQuestions.Controls.Add(addTrueFalse);
                    addTrueFalse.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                    addTrueFalse.Dock            = DockStyle.Fill;
                    addTrueFalse.Show();
                }
                else if (true)
                {
                    AddFillBlankQuestions addFillBlankQuestions = new AddFillBlankQuestions();
                    addFillBlankQuestions.TopLevel = false;
                    pnlQuestions.Controls.Add(addFillBlankQuestions);
                    addFillBlankQuestions.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                    addFillBlankQuestions.Dock            = DockStyle.Fill;
                    addFillBlankQuestions.Show();
                }
            }
        }
コード例 #2
0
        private void btnAddMultiple_Click(object sender, EventArgs e)
        {
            if (_quizMakerID > 0)
            {
                if (rdbMultiple.Checked)
                {
                    int numberOfOptions = Convert.ToInt32(txtOptionsNumeric.Value);
                    AddMultipleQuestions addMultipleQuestions = new AddMultipleQuestions(_quizMakerID);
                    addMultipleQuestions.numerOfOptions = numberOfOptions;

                    addMultipleQuestions.Show();
                }
                else if (rdbTF.Checked)
                {
                    AddTrueFalseQuestion addTrueFalse = new AddTrueFalseQuestion(_quizMakerID);
                    addTrueFalse.Show();
                }
                else if (true)
                {
                    AddFillBlankQuestions addFillBlankQuestions = new AddFillBlankQuestions(_quizMakerID);
                    addFillBlankQuestions.Show();
                }
            }
        }