Click here to Skip to main content
15,901,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everybody.

My application is a C# application develop on VS2005.In my application there is an option to switch different languages(English,Thailand,Russian, etc.).

I want to make Hot Keys for some futures.When I press "g" (Form1_KeyPress - event) return e.KeyChar 103'g'.But when I switch my computer input language for example to cyrillic and again press "g" e.KeyChar return 1075'г'.I see in another applications how to make this.

Every time when I press button 'g' on all input language in text box they show every time char 'g'.
How can I do this for a different languages in my application.

Thanks in advance.
Posted
Updated 26-Oct-11 22:45pm
v2

Do not use the KeyPress-event, use KeyUp instead.
KeyChar is the character mapped to the key, not the key itself (and of course the characters are different in different charsets).
KeyUp provides the Property KeyCode, which is unique.
 
Share this answer
 
With the KeyCode you cannot do that. Have you ever heard about the Scan Codes in keyboard. Basically scan code returns on the key press to the OS and OS is responsible to virtually map it to key code, depends on your key borad and/or the local language you set.

http://msdn.microsoft.com/en-us/library/ms892480.aspx[^]

So, pick the scan code and do the validation.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900