Groups | Blog | Home
all groups > dotnet compact framework > march 2008 >

dotnet compact framework : Textbox accept numeric values only


neera
3/27/2008 2:02:17 AM
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)
Christian Resma Helle
3/27/2008 10:32:25 AM
SetInputMode() should actually do the trick. If you use .NETCF 2.0 or higher
then theres no need to wrap it yourself (as demonstrated in
http://www.devx.com/wireless/Article/21291). Its included in the
Microsoft.WindowsCE.Forms namespace

--
Regards,
Christian Resma Helle
http://christian-helle.blogspot.com



[quoted text, click to view]
Arun
3/27/2008 2:16:03 PM
Neera,
As Christian mentioned, there is no need to write a wrapper to do
this.
Check out these links,
http://msdn2.microsoft.com/en-us/library/microsoft.windowsce.forms.inputmode=
editor.setinputmode.aspx

http://msdn2.microsoft.com/en-us/library/microsoft.windowsce.forms.inputmode=
editor.aspx

http://msdn2.microsoft.com/en-us/library/ms172542.aspx

Hope this helps,
Cheers,
Arun


On Mar 27, 2:32=A0am, "Christian Resma Helle" <xtian...@gmail.com>
[quoted text, click to view]
Sachin Palewar
3/30/2008 5:07:58 AM
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/


[quoted text, click to view]
Hilton
3/30/2008 11:04:48 AM
// 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

}



[quoted text, click to view]

Simon Hart [MVP]
3/30/2008 12:20:01 PM
CF 2 and onwards exposes property Handle which returns the IntPtr (hwnd) of
control, not need to capture anymore.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


[quoted text, click to view]
neera
4/3/2008 6:49:43 AM
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









[quoted text, click to view]
AddThis Social Bookmark Button