/// <summary> /// Delete a lesson made by the teacher /// </summary> private void DeleteLesson() { //If a lesson has been selected if (CB_Lessons.SelectedIndex > -1) { //Open new instance of db class DBRepository DB = DBRepository.GetInstance(); //Find the lesson by ID int Lesson_ID = DB.FindLessonIDByName(CB_Lessons.SelectedItem.ToString()); //Delete this lesson from the lessons and from the Groups DB.DeleteLessonByID(Lesson_ID); DB.DeleteLessonAtGroupsByID(Lesson_ID); //Get new list of lessons GetAllLessons(); MessageBox.Show("Les verwijderd!"); } else { MessageBox.Show("Selecteer item om te verwijderen"); } }