private void SetSelectedClass_Quang(DataGridViewCellEventArgs e) { string value = null; DataTable dt = StudentDAO.GetListClassesByStudentID_Quang(dataGridViewStudent.Rows[e.RowIndex].Cells["StudentID"].Value.ToString()); //class ID class Name foreach (DataRow row in dt.Rows) { value = row["ClassID"].ToString(); } cbxClassName.SelectedValue = value; }