to get Keychar values from keydata

M

manini.chaudhari

developped a UserControl and for this control I need to handle the +
and -
keys.
The KeyPress event doesn't suit because I want to have an effet when
the key
is down and when the key is up.
So, I handle the KeyDown and KeyUp events, but I received KeyCode and
not
the translated character.


If the + or - on the numpad is pressed, I receive KeyCode = Add /
Subtract
If the + or - on the main keyboard is pressed, I received (first for
+ , the
shift KeyCode) and then OemPlus, OemMinus.
I do not want to use a trick like memorize that the shift key is
pressed
before the plus key is pressed because if the keyboard is configured
differently, it may be not working.


Who know how to convert the KeyCode / KeyData provided by the
KeyEventArgs
into a character ?
 
O

Oliver Sturm

Hello manini,
Who know how to convert the KeyCode / KeyData provided by the
KeyEventArgs
into a character ?

I don't understand what you want to convert - simply check for any of the
values that could signal a + (for instance). They keyboard driver
installed on your users' systems makes sure that you get one of these
values. What is there to convert?


Oliver Sturm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top