private void CotizacionEuro_Leave(object sender, EventArgs e) { if (double.TryParse(CotizacionEuro.Text, out double auxCotizacion)) { Euros.SetCotizacion(auxCotizacion); } else { CotizacionEuro.Focus(); } }
private void txtCotizacionEuro_MouseLeave(object sender, EventArgs e) { if ((!(String.IsNullOrWhiteSpace(txtCotizacionEuro.Text))) && (Double.TryParse(txtCotizacionEuro.Text, out double cotizacionEuro))) { Euros.SetCotizacion(cotizacionEuro); } else { txtCotizacionEuro.Focus(); MessageBox.Show("Debe ingresar un valor valido", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnEuro_Click(object sender, EventArgs e) { if (!locked) { MessageBox.Show("Debe bloquearse el candado para asegurar las cotizaciones", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (Double.TryParse(txtEuro.Text, out double equivalenteEuro)) { Euros myEuro = new Euros(equivalenteEuro); Euros.SetCotizacion(Double.Parse(txtCotizacionEuro.Text)); txtEuroEuro.Text = (myEuro.GetCantidad()).ToString(); txtEuroDolar.Text = (((Dolar)myEuro).GetCantidad()).ToString(); txtEuroPeso.Text = (((Pesos)myEuro).GetCantidad()).ToString(); } } }