private void txtCodigo_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13 && txtCodigo.Text.Trim() != "") { try { if (ctl_vta.agregaProductoATempDVentas(int.Parse(txtCodigo.Text), int.Parse(numCantidad.Value.ToString()), int.Parse(lblCons.Text))) { calculos(); cargarYFormatearDataGrid(); } } catch //(Exception ex) { new frmMensaje("El Código '" + txtCodigo.Text + "' no es correcto.", 2000, 2).ShowDialog(); } txtCodigo.Clear(); txtCodigo.Focus(); } }