views:

241

answers:

1

In Windows Mobile 5 one of the following methods works to set an input to numbers only:

// Managed InputModeEditor.SetInputMode(textBox, InputMode.Numeric);

// Native Wrapper InputModeSupport.SHSetImeMode(textBox.Handle, InputModeSupport.SHIME_MODE.SHIME_MODE_NUMBERS);

In Windows Mobile 6, neither works.

How do you set the IME to "Numbers Only" in WM 6.0 / .NET CF 3.5?

A: 

To set IME mode you can use the two methods above, switching based on platform using the SystemSettings class to inform it. If you want to use the SIP instead, you can find the GUID of the WYSIWYG keyboard, or "guess" by enumerating all SIPs and choosing one with "Numeric" in its name. Ultimately though, there is no way to guarantee the numbers only keyboard in code.

Daniel Crenna