private void btnThem_Click(object sender, EventArgs e) { try { FrmNhapDonViTinh frmNhapDVT = new FrmNhapDonViTinh(); frmNhapDVT.btnOK.Tag = "add"; string strDVT = cf.CreateId("DVT", "DONVITINH"); frmNhapDVT.txtMaDVT.Text = strDVT; frmNhapDVT.ShowDialog(); LoadDonViTinh(); } catch { } }
private void btnCapNhat_Click(object sender, EventArgs e) { try { FrmNhapDonViTinh frmNhapDVT = new FrmNhapDonViTinh(); frmNhapDVT.btnOK.Tag = "up"; int index = dgvDonViTinh.SelectedRows[0].Index; string strMaDVT = dgvDonViTinh.Rows[index].Cells["colMaDonViTinh"].Value.ToString(); frmNhapDVT.txtMaDVT.Text = strMaDVT; string strDVT = dgvDonViTinh.Rows[index].Cells["colDonViTinh"].Value.ToString(); frmNhapDVT.txtDonViTinh.Text = strDVT; frmNhapDVT.ShowDialog(); LoadDonViTinh(); } catch { } }