private void cobMaNhanVien_SelectedIndexChanged(object sender, EventArgs e) { GroupBox grbThongTin = (GroupBox)this.Controls["grbThongTin"]; TextBox txtTenNV = (TextBox)grbThongTin.Controls["txtTenNhanVien"]; try { ComboBox cob = sender as ComboBox; if (cob != null && cob.SelectedValue != null) { SQL = " select * from NHANVIEN where MANHANVIEN='" + ((ComboBox)sender).SelectedValue.ToString() + "'"; DataTable dt = XuLyDuLieu.bangDuLieu(SQL); foreach (DataRow dr in dt.Rows) { txtTenNV.Text = dr["HOTEN"].ToString(); } } } catch (Exception ex) { } }