private void button1_Click(object sender, EventArgs e) { int crsID = 0; if (comboBox1.SelectedItem != null) { crsID = int.Parse(comboBox1.SelectedItem.ToString().Split(',')[0]); } else { MessageBox.Show("Please select course id", "Waring"); return; } if (!isQuestDataValid()) { MessageBox.Show("Please Enter Valid Data", "Waring"); return; } string qbody = textBox1.Text; string qtype = comboBox3.SelectedItem.ToString(); int qdeg = (int)numericUpDown1.Value; int modelAns = int.Parse(textBox2.Text); Online_Exame ent = new Online_Exame(); var last = ent.Newquestion(modelAns, qtype, qdeg, qbody, crsID).First(); //////////////////////////////////////////////////////////////////// if (last.Type.ToLower() == "mcq") { insertChoicesForQuestById(last.Quest_id); } LoadCourses(); loadQuestions(crsID); textBox1.Text = textBox2.Text = string.Empty; numericUpDown1.Value = 1; comboBox3.Text = string.Empty; }