private void txtMerma_PreviewTextInput(object sender, TextCompositionEventArgs e) { string valor = ((DecimalUpDown)sender).Value.HasValue ? ((DecimalUpDown)sender).Value.ToString() : string.Empty; e.Handled = Extensor.ValidarSoloNumerosDecimales(e.Text, valor); }
/// <summary> /// utilizaremos el evento PreviewTextInput para validar numeros con decimales /// </summary> /// <param name="sender">objeto que implementa el método</param> /// <param name="e">argumentos asociados</param> /// <returns></returns> private void TxtValidarSoloNumerosDecimalesPreviewTextInput(object sender, TextCompositionEventArgs e) { e.Handled = Extensor.ValidarSoloNumerosDecimales(e.Text, ((TextBox)sender).Text); }
private void MermaPermitida(object sender, TextCompositionEventArgs e) { string texto = ((TextBox)sender).Text; e.Handled = Extensor.ValidarSoloNumerosDecimales(e.Text, texto ?? string.Empty); }
/// <summary> /// Validar número decimal limitado a 6 enteros y 2 decimales /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TxtSoloNumerosDecimalesPreviewTextInput(object sender, TextCompositionEventArgs e) { var importeTxt = (TextBox)sender; e.Handled = Extensor.ValidarSoloNumerosDecimales(e.Text, importeTxt.Text); }