Textbox accept numeric values only

N

neera

I am trying to make a textbox accept numeric values only and the
target device is Treo700w using WM5.

I have tried that with suggested SetInputMode() method and used the
code given in http://www.devx.com/wireless/Article/21291

I am not getting any error but not able to do that .
Is there anything else that we have to set for using SetInputMode()
method?

Thanks.

Neera Sharma
Palewar Techno Solutions
(Mobile Solutions for Your Business)
www.palewar.com
 
S

Sachin Palewar

Treo 700W is actually based on Pocket PC Platform instead of a
Smartphone platform. Although its referred as Smartphone by Palm and
we need to input 2 in the textbox when we press 'R' on its physical
keyboard as its used to type 2 in numeric mode after pressing the alt
key.

So we need a Pocket PC compatible code. Please let us know if any of
you have any suggestions.

Regards,
Sachin Palewar

Palewar Techno Solutions
(Mobile Solutions for Your Business)
http://www.palewar.com/
http://palewar.blogspot.com/
 
H

Hilton

// Get the handle

this.Capture = true;

IntPtr hWnd = GetCapture();

this.Capture = false;

int lStyle = BaseTextBox.GetWindowLong (hWnd, GetWindowLongParam.GWL_STYLE);

lStyle |= (int) es;

BaseTextBox.SetWindowLong (hWnd, GetWindowLongParam.GWL_STYLE, lStyle);

----------------------

public enum GetWindowLongParam

{

GWL_WNDPROC = (-4),

GWL_HINSTANCE = (-6),

GWL_HWNDPARENT = (-8),

GWL_STYLE = (-16),

GWL_EXSTYLE = (-20),

GWL_USERDATA = (-21),

GWL_ID = (-12)

}

public enum EditStyle

{

ES_LEFT = 0x0000,

ES_CENTER = 0x0001,

ES_RIGHT = 0x0002,

ES_MULTILINE = 0x0004,

ES_UPPERCASE = 0x0008,

ES_LOWERCASE = 0x0010,

ES_PASSWORD = 0x0020,

ES_AUTOVSCROLL = 0x0040,

ES_AUTOHSCROLL = 0x0080,

ES_NOHIDESEL = 0x0100,

ES_COMBOBOX = 0x0200,

ES_OEMCONVERT = 0x0400,

ES_READONLY = 0x0800,

ES_WANTRETURN = 0x1000,

ES_NUMBER = 0x2000

}
 
S

Simon Hart [MVP]

CF 2 and onwards exposes property Handle which returns the IntPtr (hwnd) of
control, not need to capture anymore.
 
N

neera

Thanks for your suggestions. I have tried with the given code That is
also so much helpful for me. But what I am trying to do is whenever
the key for 'E' will be pressed, '2' should be entered. by the given
code I can validate textbox for not accepting any character , only
number will be accepted but for that I have to press one extra key .
That extra key press I want to remove.

Please give some direction to solve the problem.
Thanks a lot.


Neera Sharma
Palewar Techno Solutions
(Mobile Solutions for Your Business)
www.palewar.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top