c# - KeyCode and keyboard layout and language -


I have to include asterisks as an acceptable entry on the text box.

How can I test this key under keyboarding incident regardless of keyboard layout and language?

With the Portuguese QWERTY layout, ignoring this numeric keypad, this key can be tested through the key. Keys.Oemplus . But this will not be the case for other layouts or languages ​​

You are using the wrong event, you Keypad should be used. That fire when the user presses the actual typing key KeyDown is useless here, according to the keyboard layout the virtual key is translated into a typing key. It is difficult to guess that unless you translate keystrokes yourself, it may be difficult.

Some code:

  Private zero text box1_keyPress (Object Sender, KeyPressEventArgs E) {string allowed = "0123456789 * \ b"; If allowed (Index (E.Keker) <0) e.Handled = true; }  

The user is required to \ b to allow backspace.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -