private void addStudentButton_Click(object sender, EventArgs e) { if (studentComboBox.SelectedIndex == -1) { MessageBox.Show("You must choose a valid student to add to the group."); return; } Student student = (Student)studentComboBox.SelectedItem; APIHandler.AddStudentToGroup(student, this.group); groupStudents.Add(student); allNonGroupStudents.Remove(student); }