i am working on reading the user input from textbox. Textbox should accept only numeric and it is working fine. but its taking only single digit as the input. if i enter two digit number in textbox, it is assigning the last digit as the value.
Ex : input is 25. value gets assigned from textbox is 5.
How can i assign full number from textbox.
private void Val(object sender, TextCompositionEventArgs e)
{
var textBox = sender as TextBox;
e.Handled = Regex.IsMatch(e.Text, "[^0-9]+");
if (!e.Handled)
{
value = Int32.Parse(e.Text);
}
}