private void btnAdd_Click(object sender, EventArgs e) { if (cboCourse.SelectedValue == null || txtTitle.Text == "") { MessageBox.Show("请输入完整的题目信息!"); } else if (txtAnswer.Text == "") { MessageBox.Show("请输入正确答案!"); } else { try { JudgeQuestionProblem jqp = new JudgeQuestionProblem(cboCourse.SelectedValue.ToString(), txtTitle.Text, txtAnswer.Text); QuestionBll.AddquestionProblem(jqp); MessageBox.Show("添加成功!"); this.Close(); } catch (Exception ee) { MessageBox.Show("添加失败!" + ee); throw; } } }