private void buttonAdd_Click(object sender, EventArgs e) { try { Course c = new Course(); c.courseName = textBoxCourseName.Text; c.cId = Int32.Parse(comboBoxClaasId.Text); bool b = AdminController.AddCourse(c); if (b) { MessageBox.Show("Courses Added"); this.Close(); } else { MessageBox.Show("Failed"); } } catch (Exception) { MessageBox.Show("Invalid input"); } }