private void btnDelete_Click(object sender, EventArgs e)
 {
     if (gridCourses.SelectedRows[0] == null)
     {
         MessageBox.Show("Alegeti materia pe care doriti sa o stergeti.", "Atentie", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         DataGridViewRow rowTeacher = gridTeachers.SelectedRows[0];
         DataGridViewRow rowCourse  = gridCourses.SelectedRows[0];
         DialogResult    result     = MessageBox.Show("Sunteti sigur ca doriti sa stergeti " + rowCourse.Cells["CourseName"].Value.ToString() + " din lista de materii predate de " + rowTeacher.Cells["TeacherName"].Value.ToString() + " " + rowTeacher.Cells["TeacherSurname"].Value.ToString() + "?", "Confirmare", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (result == DialogResult.Yes)
         {
             BLAdmin bl = new BLAdmin();
             bl.DeleteTeacherCourse(Convert.ToInt32(rowTeacher.Cells["TeacherId"].Value), Convert.ToInt32(rowCourse.Cells["CourseId"].Value));
             MessageBox.Show("Cursul a fost sters cu succes!", "Succes", MessageBoxButtons.OK, MessageBoxIcon.Information);
             gridCourses.DataSource = bl.GetCourses(Convert.ToInt32(rowTeacher.Cells["TeacherId"].Value));
             DataTable tableCourses = bl.GetListOfCourses(Convert.ToInt32(rowTeacher.Cells["TeacherId"].Value));
             comboBoxCourses.ValueMember   = "CourseId";
             comboBoxCourses.DisplayMember = "CourseName";
             comboBoxCourses.DataSource    = tableCourses;
             comboBoxCourses.SelectedItem  = null;
         }
         else
         {
             return;
         }
     }
 }