How to change input type of textbox to numbers (C#)

  • Thread starter Thread starter agvaniya
  • Start date Start date
A

agvaniya

Hi,
I'm writing an utility in c# under WM6 for HTC Excalibur (qwerty
keyboard)
In the utility there's an edit box which should change the input to
numbers instead of abc
how can i do it?


thanks !
 
Hi,
I'm writing an utility in c# under WM6 for HTC Excalibur (qwerty
keyboard)
In the utility there's an edit box which should change the input to
numbers instead of abc
how can i do it?

thanks !

LOL
just solved it myself via collection of data from several forums,
maybe will be helpful to others:

[DllImport("coredll.dll", EntryPoint = "SendMessage")]
private static extern uint SendMessage(IntPtr hWnd, uint msg,
uint wParam, uint lParam);
[DllImport("coredll.dll", EntryPoint = "GetCapture")]
private static extern IntPtr GetCapture();
[DllImport("coredll.dll", EntryPoint = "GetWindow")]
private static extern IntPtr GetWindow(IntPtr hWnd, int
uCmd);

private const int GW_CHILD = 5;
private const uint EM_SETINPUTMODE = 0x00DE;
private const uint EIM_NUMBERS = 2;
public SetMode() {
textBox1.Capture = true;
IntPtr hWndUser = GetCapture();
hWndUser = GetWindow(hWndUser, GW_CHILD);
textBox1.Capture = false;
SendMessage(hWndUser, EM_SETINPUTMODE, 0, EIM_NUMBERS);
}
 
You should be able to use InputModeEditor class under
Microsoft.WindowsCE.Forms namespace
and call SetInputMode and pass on control and mode as numeric instead
PInvoking,
Take a look at this here,
http://msdn.microsoft.com/en-us/library/microsoft.windowsce.forms.inputmodeeditor.setinputmode.aspx

Cheers,
Arun


Hi,
I'm writing an utility in c# under WM6 for HTC Excalibur (qwerty
keyboard)
In the utility there's an edit box which should change the input to
numbers instead of abc
how can i do it?

LOL
just solved it myself via collection of data from several forums,
maybe will be helpful to others:

        [DllImport("coredll.dll", EntryPoint = "SendMessage")]
        private static extern uint SendMessage(IntPtr hWnd, uint msg,
uint wParam, uint lParam);
        [DllImport("coredll.dll", EntryPoint = "GetCapture")]
        private static extern IntPtr GetCapture();
        [DllImport("coredll.dll", EntryPoint = "GetWindow")]
        private static extern IntPtr GetWindow(IntPtr hWnd, int
uCmd);

        private const int GW_CHILD = 5;
        private const uint EM_SETINPUTMODE = 0x00DE;
        private const uint EIM_NUMBERS = 2;
        public SetMode() {
            textBox1.Capture = true;
            IntPtr hWndUser = GetCapture();
            hWndUser = GetWindow(hWndUser, GW_CHILD);
            textBox1.Capture = false;
            SendMessage(hWndUser, EM_SETINPUTMODE, 0, EIM_NUMBERS);
        }
 
Back
Top