// Sự kiện tìm theo tên nhóm sau khi enter textbox; private void toolStripTextBox1_KeyPress(object sender, KeyPressEventArgs e) { string tenNhom = tbsearch.Text; List <TenNhomCT> contactNames = TenNhomCT.GetListFromFile(pathDataNhomCT, tenNhom); if (contactNames == null) { MessageBox.Show("Nhóm không tồn tại, Vui lòng nhập chính xác tên nhóm."); return; } bdsTenNhomCT.DataSource = contactNames; dgvTenNhomCT.DataSource = bdsTenNhomCT; }
private void dgvTenNhomCT_CellClick(object sender, DataGridViewCellEventArgs e) { if (dgvTenNhomCT.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null) { dgvTenNhomCT.CurrentRow.Selected = true; lbtenLienLac.Text = dgvTenNhomCT.Rows[e.RowIndex].Cells["Column2"].FormattedValue.ToString(); // lbdiachi.Text = dgvTenNhomCT.Rows[e.RowIndex].Cells["Column2"].FormattedValue.ToString(); lbemail.Text = dgvTenNhomCT.Rows[e.RowIndex].Cells["Column4"].FormattedValue.ToString(); lbsodienthoai.Text = dgvTenNhomCT.Rows[e.RowIndex].Cells["Column4"].FormattedValue.ToString(); string sdt = dgvTenNhomCT.Rows[e.RowIndex].Cells["Column4"].FormattedValue.ToString(); List <TenNhomCT> abc = TenNhomCT.GetListFromFilesdt(pathDataNhomCT, sdt); lbdiachi.Text = abc[0].diachi; } }
private void dgvTenNhom_CellClick(object sender, DataGridViewCellEventArgs e) { if (dgvTenNhom.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null) { string justClickedcell = dgvTenNhom.Rows[e.RowIndex].Cells["Column1"].FormattedValue.ToString(); dgvTenNhomCT.AutoGenerateColumns = false; List <TenNhomCT> abc = TenNhomCT.GetListFromFile(pathDataNhomCT, justClickedcell); if (abc == null) { return; } bdsTenNhomCT.DataSource = abc; dgvTenNhomCT.DataSource = bdsTenNhomCT; } }