Getting the value of a key press

DaveP

Member
Joined
Jan 24, 2008
Messages
12
Programming Experience
1-3
When creating a custom control with a textbox on it, I find that the System.Windows.Controls.Textbox doesn't have a keypress property.

I can use e.key to discriminate between various kinds of keys, but once I have trapped a particular keypress (lets say its 2 on the top row) I find that e.key.ToString returns "D2".

So how can I find the ascii value of the key returned.

and out of curiosity, why does a textbox on a form have a keypress property, but not a textbox in a custom control. :confused:
 
So how can I find the ascii value of the key returned.

and out of curiosity, why does a textbox on a form have a keypress property, but not a textbox in a custom control. :confused:

Did you check to see if your new custom control has a KeyPress event now?

I am pretty sure it would.
 
Back
Top