private void btnSave_Click(object sender, EventArgs e) { if (!validateStudent()) { return; } string message = string.Empty; TheStudent.StudentID = Convert.ToInt32(textBoxID.Text); TheStudent.Name = textBoxName.Text; TheStudent.Gender = comboBoxGender.Text; TheStudent.Group = comboBoxGroup.Text; TheStudent.Courses = _courseList; try { if (TheStudent.SerialNo > 0) { DALStudent.Update(TheStudent); } else { DALStudent.Insert(TheStudent); } MessageBox.Show("Record Saved Successfully"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }