private void btnThem_Click(object sender, EventArgs e) { try { FrmNhapKhoHang frmNhapKhoHang = new FrmNhapKhoHang(); frmNhapKhoHang.btnOK.Tag = "add"; string strMaKho = cf.CreateId("MKO", "KHO"); frmNhapKhoHang.txtMaKho.Text = strMaKho; frmNhapKhoHang.ShowDialog(); LoadKhoHang(); } catch { } }
private void btnCapNhat_Click(object sender, EventArgs e) { FrmNhapKhoHang frmNhapKhoHang = new FrmNhapKhoHang(); try { frmNhapKhoHang.btnOK.Tag = "up"; int index = dgvKhoHang.SelectedRows[0].Index; string strMaKho = dgvKhoHang.Rows[index].Cells["colMaKho"].Value.ToString(); frmNhapKhoHang.txtMaKho.Text = strMaKho; string strTenKho = dgvKhoHang.Rows[index].Cells["colTenKho"].Value.ToString(); frmNhapKhoHang.txtTenKho.Text = strTenKho; string strDienThoaiBan = dgvKhoHang.Rows[index].Cells["colDienThoai"].Value.ToString(); frmNhapKhoHang.txtDienThoaiBan.Text = strDienThoaiBan; string strDienThoaiDD = dgvKhoHang.Rows[index].Cells["colDiDong"].Value.ToString(); frmNhapKhoHang.txtDienThoaiDD.Text = strDienThoaiDD; string strNguoiLienHe = dgvKhoHang.Rows[index].Cells["colNguoiLienHe"].Value.ToString(); frmNhapKhoHang.cmbNhanVien.Tag = strNguoiLienHe; string strFax = dgvKhoHang.Rows[index].Cells["colFax"].Value.ToString(); frmNhapKhoHang.txtFax.Text = strFax; string strDiaChi = dgvKhoHang.Rows[index].Cells["colDiaChi"].Value.ToString(); frmNhapKhoHang.txtDiaChi.Text = strDiaChi; string strGhiChu = dgvKhoHang.Rows[index].Cells["colGhiChu"].Value.ToString(); frmNhapKhoHang.txtGhiChu.Text = strGhiChu; frmNhapKhoHang.ShowDialog(); LoadKhoHang(); } catch { frmNhapKhoHang.ShowDialog(); LoadKhoHang(); } finally { } }