コード例 #1
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            EdicionProducto frm = new EdicionProducto();

            frm.ShowDialog();
            CargarDatos();
        }
コード例 #2
0
 private void btnEditar_Click(object sender, EventArgs e)
 {
     try
     {
         if (MessageBox.Show("Desea editar el registro seleccionado?", "Pregunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             EdicionProducto frm = new EdicionProducto();
             frm.txbIDProducto.Text         = dtgRegistros.CurrentRow.Cells[0].Value.ToString();
             frm.txbNombre.Text             = dtgRegistros.CurrentRow.Cells[1].Value.ToString();
             frm.txtAlias.Text              = dtgRegistros.CurrentRow.Cells[2].Value.ToString();
             frm.txbCodigo.Text             = dtgRegistros.CurrentRow.Cells[3].Value.ToString();
             frm.cbbCategoria.SelectedValue = dtgRegistros.CurrentRow.Cells[4].Value;
             frm.nupPrecio.Text             = dtgRegistros.CurrentRow.Cells[6].Value.ToString();
             frm.nupCosto.Text              = dtgRegistros.CurrentRow.Cells[7].Value.ToString();
             frm.txbDescripcion.Text        = dtgRegistros.CurrentRow.Cells[8].Value.ToString();
             frm.ShowDialog();
             CargarDatos();
         }
     }
     catch
     {
         MessageBox.Show("Ocurrio un Error a la hora de EDITAR", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }