private void gridTeachers_CellValueChanged(object sender, DataGridViewCellEventArgs e) { DataGridViewRow row = gridTeachers.SelectedRows[0]; int teacherId = Convert.ToInt32(row.Cells["TeacherId"].Value); String name = row.Cells["TeacherName"].Value.ToString(); String surname = row.Cells["TeacherSurname"].Value.ToString(); String dept = row.Cells["Department"].Value.ToString(); BLAdmin bl = new BLAdmin(); bl.UpdateTeacher(teacherId, name, surname, dept); gridTeachers.DataSource = bl.GetTeachers(txtNameFilter.Text, txtSurnameFilter.Text, comboBoxDept.GetItemText(comboBoxDept.SelectedItem)); }