Tuesday, February 20, 2007 8:51 PMHi, I'm trying to make a textbox that only allows people to enter numbers - when you press a number it immediately shows the actual number, not the letter associated with it. Can anyone give a code snippet or some ideas on how to do that.
Wednesday, February 21, 2007 4:44 AMJust use MFC EditBox and set it to numerical mode.
Wednesday, February 21, 2007 5:34 AMWhere can I find that?
Thursday, February 22, 2007 2:40 AM
Edit box is available as a component within the existent MFC support that came with WM5.0 SDK.
For more info, check:
Thursday, April 19, 2007 12:45 PM
From your description I think you are attempting to develop an application for a smartphone. The problem you are finding is that pressing the '2' key on the phone is cycling through the letters A, B, and C before getting to the number 2, which is anoying when you want a textbox to only accept numbers.
If this is the situation you are finding yourself in the situation is relativly easy to resolve. You don't mention if you are developing your application in managed or native code so I'll explain the solution for both situations.
In managed code:
Include a reference to the Microsoft.WindowsCE.Forms.dll assembly
call the method InputModeEditor.SetInputMode as follows (where textBox1 is the name of the textbox which should only accept numeric input)
In native code:
Send your edit control an EM_SETINPUTMODE message as follows (where m_hwndEdit is the hwnd of your edit control)
SendMessage(m_hwndEdit, EM_SETINPUTMODE, 0, EIM_NUMBERS);
Hope this helps,