Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Compact Framework / May 2008

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
agvaniya@gmail.com - 15 May 2008 08:58 GMT
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 !
agvaniya - 15 May 2008 09:34 GMT
On May 15, 9:58 am, "agvan...@gmail.com" <agvan...@gmail.com> wrote:
> Hi,
> I'm writing an utility in c# under WM6 for HTC Excalibur (qwerty
[quoted text clipped - 4 lines]
>
> 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);
       }
Arun - 15 May 2008 16:32 GMT
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.inputmodeedito
r.setinputmode.aspx


Cheers,
Arun

> On May 15, 9:58 am, "agvan...@gmail.com" <agvan...@gmail.com> wrote:
>
[quoted text clipped - 30 lines]
>             SendMessage(hWndUser, EM_SETINPUTMODE, 0, EIM_NUMBERS);
>         }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.