Home » VB.NetRSS

Input mode on inputbox

Hello

Can i change the input mode width InputModeEditor.SetInputMode for an inputbox? I need to take only numbers from an inputbox.

Best regards.

 

7 Answers Found

 

Answer 1

Hi Imanligenc ,

Please check this :

http://msdn.microsoft.com/en-us/library/ms229644(VS.90).aspx

 

Hope this will help you.

 

Answer 2

Or maybe you could use as you want

http://msdn.microsoft.com/en-us/library/microsoft.windowsce.forms.inputmodeeditor.setinputmode(VS.90).aspx

But not sure if it allows to set the input mode for the InputBox. If not, you could consider to create your own

modal dialog containing a textbox.

 

Answer 3

By input box, i assume you mean TextBox? You can use the InputModeEditor on your TextBox.

 

Something like this:

InputModeEditor.SetInputMode(yourTextBoxControl, InputMode.Numeric)

 

This by the way only works on the Smartphone (also known as Windows Mobile Standard) platform

 

Answer 4

I mean inputbox() function. And the InputModeEditor.SetInputMode can't be used on an inputbox.
 

Answer 5

Have you seen this:

http://social.msdn.microsoft.com/Forums/en-US/netfxcompact/thread/16875bbd-0c7c-491b-bbe2-4a9811054706

 

Christopher Fairbairn made a customized version of an InputBox that you might find interesting. You can get it here:

http://www.christec.co.nz/blog/wp-content/uploads/2007/07/inputbox.zip

 

Answer 6

InputModeEditor.SetInputMode(textBox1, InputMode.Numeric);

But this will not work in case of Pocket PC (Touch Based phones) Only for Smart Phones

You may cretae your own method for this check whether textbox have numeric or alphabets in it like this

private bool CheckNumeric(string number)
        {
            bool flag = true;
            for (int i = 0; (i < number.Length) && (flag == true); i++)
            {
                char[] temp2 = number.Substring(i, 1).ToCharArray();
                char[] temp3 = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
                if (temp2[0].Equals(temp3[0]) || temp2[0].Equals(temp3[1]) || temp2[0].Equals(temp3[2]) || temp2[0].Equals(temp3[4]) || temp2[0].Equals(temp3[5]) || temp2[0].Equals(temp3[6]) || temp2[0].Equals(temp3[3]) || temp2[0].Equals(temp3[7]) || temp2[0].Equals(temp3[8]) || temp2[0].Equals(temp3[9]))
                    flag = true;
                else
                {
                    flag = false;
                    i = number.Length;
                }
            }
            return flag;
        }

 

Answer 7

thanks for your answers.
 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter