コード例 #1
0
ファイル: MainForm.cs プロジェクト: pleveque/ITTraleeCK
        /**
         * Method to post a answer in tab Post a Answer when the button "Post a answer" is clicked
         */
        private void buttonPostAnswer_Click(object sender, EventArgs e)
        {
            if (comboBoxQuestions.Equals("") || textBoxAnswer.Text != null)
            {
                try
                {
                    //Call method to create a answer with pass in arguments the id of question selected in combobox and the the content of answer written
                    DAOAnswer.CreateAnswer(comboBoxQuestions.SelectedIndex, textBoxAnswer.Text);

                    MessageBox.Show("Answer posted");

                    comboBoxQuestions.Text = "";
                    textBoxAnswer.Text     = "";
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                MessageBox.Show("Your can't post empty Answer");
            }
        }