private void btnNuevo_Click(object sender, EventArgs e) { try { Formula.Registros.frmIngresoSocio ofrmIngresoSocio = new Formula.Registros.frmIngresoSocio(); if (dgvSocios.Rows.Count == 0 && string.IsNullOrEmpty(txtRazonSocial.Text.Trim())) { Cargasocio(5); } ofrmIngresoSocio.ShowDialog(); // txtRazonSocialSocio.Text = ofrmBusquedaSocio.RazorSocialSocio.Trim(); DataRow row = dsSocio.Tables[0].NewRow(); row["RazonSocial"] = ofrmIngresoSocio.RazonSocialSocio.Trim(); row["NumDoc"] = ofrmIngresoSocio.Ruc.Trim(); dsSocio.Tables[0].Rows.Add(row); if (dsSocio.Tables[0].Rows.Count > 0) { dgvSocios.DataSource = dsSocio.Tables[0]; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnEditar_Click(object sender, EventArgs e) { try { if (dgvSocios.RowCount > 0) { if (dgvSocios.CurrentRow.Cells["FlgEditar"].Value.ToString().Equals("1")) { Formula.Registros.frmIngresoSocio ofrm = new Formula.Registros.frmIngresoSocio(); ofrm.Operacion = "M"; ofrm.Codigo = dgvSocios.CurrentRow.Cells["CodCliente"].Value.ToString(); ofrm.ShowDialog(); btnBuscar.PerformClick(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }