Hi moondaddy,
You aren't telling is what kind of input you are talking about, but the
Char
class has a set of static methods for determining what type a given
character
is. For instance System.Char.IsDigit(), ...IsLetter(), ...IsControl().
If you mean input keys as in KeyEvent... there is no way to determine if a
given Key is a digit, letter or special character. You have to set up a
list
of keys for each type, like D0-D9 + NumPad0-NumPad9 would mean digit
input.
To ignore invalid entries in a TextBox, handle the OnKeyPress event and
check the Char value. If not valid, set KeyPressEventArgs.Cancel to true.
--
Happy Coding!
Morten Wennevik [C# MVP]
moondaddy said:
Is there a simple way to determine if an input key is a number, letter or
special character? in other words, was the user inputting data and not
typing a backspace, shift, etc.
Thanks.