-1
//Função para permitir somente números e ponto
private void ApenasValorNumerico(object sender, KeyEventArgs e)
{
TextBox txt = (TextBox)sender;
if (e.Key != Key.Back)
{
if (Convert.ToChar(e.Key) == '.')
e.Handled = (txt.Text.Contains('.'));
else
e.Handled = true;
}
}
Well, I found this code in another post, and modified it to try to use in my application for Windowsphone, but I don’t know where the error is.. I am a beginner. Thanks in advance for any help..
PS.: Actually no error occurs, it just doesn’t work.. the method is called but it doesn’t allow inclusion in the textbox.. none of the "keys" work, nor numbers, nor point.
What error occurs?
– user28595
Detail plus the question, report the error that is happening, any additional information you find later should be added in the question itself, not in an answer. And don’t forget to mark the answer that best helped you/solved the case.
– Edson Horacio Junior
Actually no error occurs, it simply does not work.. the method is called but it does not allow inclusion in the textbox.. none of the "keys" work, nor numbers, nor point..
– 7..BK
This appears to be the original: http://answall.com/questions/28129/stilo-moeda-numa-textbox-em-winforms/28192#28192
– brasofilo
@Yes, this is the original..
– 7..BK