I am trying to check if a textbox contains a number. The problem is that it always returns that it contains a non-numeric character. I've tried several ways, but none of them seems to work.
One of the ways I've tried is:
if( Regex.IsMatch(tb.Text.Trim(), @"^[0-9]+$")) // tb.Text is the textbox
It does not matter what I enter in the textbox, it always returns that it contains a non-numeric character (I tried entering 1-9, 'a', 'b')