private void buttonUploadQuiz_Click(object sender, EventArgs e) { string fullName = comboBoxSelectCourse.Text; string nameCourse = fullName.Remove(fullName.Length - 2, 2); string nameSection = comboBoxSelectCourse.Text; nameSection = "" + nameSection[fullName.Length - 1]; string selectedId = comboBoxSelectStudent.Text; selectedId = selectedId.Substring(0, selectedId.IndexOf(" ")).Trim(); CourseResults cr = new CourseResults(); cr.CourseName = nameCourse; cr.Section = nameSection; cr.Semester = comboBoxSelectSemester.Text; cr.AccountId = selectedId; cr.Quiz = (double)numericUpDownUploadQuizMark.Value; cr.Term = 0; cr.FinalMark = 0; cr.Grade = 0; cr.Status = "Active"; CourseResultsRepository crr = new CourseResultsRepository(); if (crr.UpdateQuizMark(cr)) { MessageBox.Show("Quiz Mark uploaded Successfully"); } else { MessageBox.Show("OOPS !!! Something went wr"); } }