private void btnAgregar_Click(object sender, EventArgs e) { EdicionCliente frm = new EdicionCliente(); frm.ShowDialog(); CargarDatos(); }
private void btnEditar_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Desea editar el registro seleccionado?", "Pregunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { EdicionCliente frm = new EdicionCliente(); frm.txbIDCliente.Text = dtgRegistros.CurrentRow.Cells[0].Value.ToString(); frm.txbNombres.Text = dtgRegistros.CurrentRow.Cells[1].Value.ToString(); frm.txbApellidos.Text = dtgRegistros.CurrentRow.Cells[2].Value.ToString(); frm.txbDirección.Text = dtgRegistros.CurrentRow.Cells[3].Value.ToString(); frm.txbTelefono.Text = dtgRegistros.CurrentRow.Cells[4].Value.ToString(); frm.ShowDialog(); CargarDatos(); } } catch { MessageBox.Show("Ocurrio un Error a la hora de EDITAR", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }