private void btnActualizar_Click(object sender, EventArgs e) { if (TabControl1.TabPages[0].Focus()) { if (dgvPrestamo.Rows.Count < 1) { MessageBox.Show("No hay registros para actualizar", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { FrmPrestamoActualizar frmPrestamoActualizar = new FrmPrestamoActualizar(); frmPrestamoActualizar.Show(); frmPrestamoActualizar.txtPrestamo.Text = dgvPrestamo.CurrentRow.Cells["prestamo"].Value.ToString(); frmPrestamoActualizar.dtpFecha.Text = dgvPrestamo.CurrentRow.Cells["fecha"].Value.ToString(); frmPrestamoActualizar.dtpFechaLimite.Text = dgvPrestamo.CurrentRow.Cells["fechaLimite"].Value.ToString(); frmPrestamoActualizar.txtCantidad.Text = dgvPrestamo.CurrentRow.Cells["cantidad"].Value.ToString(); frmPrestamoActualizar.txtRecargo.Text = dgvPrestamo.CurrentRow.Cells["recargo"].Value.ToString(); frmPrestamoActualizar.cboFormaPago.Text = dgvPrestamo.CurrentRow.Cells["formaPago"].Value.ToString(); frmPrestamoActualizar.txtTotal.Text = dgvPrestamo.CurrentRow.Cells["total"].Value.ToString(); frmPrestamoActualizar.txtTotalAbono.Text = dgvPrestamo.CurrentRow.Cells["totalAbono"].Value.ToString(); frmPrestamoActualizar.txtSaldo.Text = dgvPrestamo.CurrentRow.Cells["saldo"].Value.ToString(); frmPrestamoActualizar.txtCedulaCliente.Text = dgvPrestamo.CurrentRow.Cells["cedulaCliente"].Value.ToString(); frmPrestamoActualizar.txtCedulaCobrador.Text = dgvPrestamo.CurrentRow.Cells["cedulaCobrador"].Value.ToString(); } } else if (TabControl1.TabPages[1].Focus()) { if (dgvPrestamoBuscar.Rows.Count < 1) { MessageBox.Show("No hay registros para actualizar", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { FrmPrestamoActualizar frmPrestamoActualizar = new FrmPrestamoActualizar(); frmPrestamoActualizar.Show(); frmPrestamoActualizar.txtPrestamo.Text = dgvPrestamoBuscar.CurrentRow.Cells["prestamo"].Value.ToString(); frmPrestamoActualizar.dtpFecha.Text = dgvPrestamoBuscar.CurrentRow.Cells["fecha"].Value.ToString(); frmPrestamoActualizar.dtpFechaLimite.Text = dgvPrestamoBuscar.CurrentRow.Cells["fechaLimite"].Value.ToString(); frmPrestamoActualizar.txtCantidad.Text = dgvPrestamoBuscar.CurrentRow.Cells["cantidad"].Value.ToString(); frmPrestamoActualizar.txtRecargo.Text = dgvPrestamoBuscar.CurrentRow.Cells["recargo"].Value.ToString(); frmPrestamoActualizar.cboFormaPago.Text = dgvPrestamoBuscar.CurrentRow.Cells["formaPago"].Value.ToString(); frmPrestamoActualizar.txtTotal.Text = dgvPrestamoBuscar.CurrentRow.Cells["total"].Value.ToString(); frmPrestamoActualizar.txtTotalAbono.Text = dgvPrestamoBuscar.CurrentRow.Cells["totalAbono"].Value.ToString(); frmPrestamoActualizar.txtSaldo.Text = dgvPrestamoBuscar.CurrentRow.Cells["saldo"].Value.ToString(); frmPrestamoActualizar.txtCedulaCliente.Text = dgvPrestamoBuscar.CurrentRow.Cells["cedulaCliente"].Value.ToString(); frmPrestamoActualizar.txtCedulaCobrador.Text = dgvPrestamoBuscar.CurrentRow.Cells["cedulaCobrador"].Value.ToString(); } } }
public FrmPrestamoActualizar() { FrmPrestamoActualizar.frmPrestamoActualizar = this; InitializeComponent(); }