"Ray Mitchell" <Ra*****************@MeanOldTeacher.comwrote in message
news:AE**********************************@microsof t.com...
Hello,
I have a KeyDown event in which I would like to determine if the current
key
is a standard character (i.e., from the ASCII character set). [...]
My only other thought is to individually test the value of the
KeyCode against each key value I am willing to accept, but this is much to
brutal and I'm sure, inappropriate.
The KeyDown event doesn't tell you much at all about the character being
entered. It tells you which physical key is being pushed. This can be
converted to a specific character code, of course, but the event is really
more for situations where the specific key being pushed is interesting to
you.
If you want a more character-oriented input scheme, you may want to consider
looking at the KeyPress event instead. That will return ASCII values, which
you can then check for inclusion as a "standard character" (however you
choose to define that).
The IsInputKey() method is not really relevant, I think. It is more useful
if you already have code that determines whether the KeyDown event
corresponds to a key that would not normally be considered an input key, but
which you would like to for some reason. You can override it and then
return true if you don't want the key preprocessed (for example, if you have
a text-editing control and you want tab characters to be entered into it
instead of having the focus changed).
Pete