InputModeEditor Class
Assembly: Microsoft.WindowsCE.Forms (in microsoft.windowsce.forms.dll)
You can set the input mode only on a TextBox. To specify an input mode, specify one of the values from the InputMode enumeration. The Smartphone supports the ABC, T9, and numeric input modes.
The AlphaCurrent mode is the preferred input mode value for text boxes used for alpha characters. This mode matches the mode selected by holding down the star (*) key on the Smartphone. You cannot use an InputModeEditor to explicitly change casing settings for alpha input modes. However, the alpha input mode used (T9 or ABC) are retained by the AlphaCurrent input mode when set with the star key.
Supported on Smartphone 2003. Using this class on a device other than the Smartphone or on a control other than a TextBox fails but no exception is thrown.
The following code example shows setting the input mode on three text boxes: Name, Phone, and City. The Name and City text boxes are set with the AlphaCurrent input mode and the Phone text box is set with the Numeric input mode.
To observe how AlphaCurrent works, perform the following procedure:
-
With the Name text box selected, hold down the star key and enter text using either the T9 or ABC input modes.
-
Enter text in the City text box. Note that the input mode is the same as the Name text box.
Imports System Imports System.Windows.Forms Imports Microsoft.WindowsCE.Forms Public Class Form1 Inherits System.Windows.Forms.Form Private mainMenu1 As System.Windows.Forms.MainMenu Private mi1 As System.Windows.Forms.MenuItem ' Text box for name. Private textBox1 As System.Windows.Forms.TextBox ' Text box for phone number. Private textBox2 As System.Windows.Forms.TextBox ' Text box for city. Private textBox3 As System.Windows.Forms.TextBox ' Labels for name, phone, and city Private label1 As System.Windows.Forms.Label Private label2 As System.Windows.Forms.Label Private label3 As System.Windows.Forms.Label Public Sub New() InitializeComponent() ' Add a menu to close the application. mi1 = New MenuItem() mainMenu1.MenuItems.Add(mi1) AddHandler mi1.Click, AddressOf mi1_Click mi1.Text = "Done" ' Set input mode for name text box to AlphaCurrent. InputModeEditor.SetInputMode(textBox1, InputMode.AlphaCurrent) ' Set input mode for phone number text box to Numeric. InputModeEditor.SetInputMode(textBox2, InputMode.Numeric) ' Set input mode for city text box to AlphaCurrent. InputModeEditor.SetInputMode(textBox3, InputMode.AlphaCurrent) End Sub Protected Overrides Sub Dispose(disposing As Boolean) MyBase.Dispose(disposing) End Sub Private Sub InitializeComponent() Me.mainMenu1 = New System.Windows.Forms.MainMenu() Me.mainMenu1 = New System.Windows.Forms.MainMenu() Me.textBox1 = New System.Windows.Forms.TextBox() Me.textBox2 = New System.Windows.Forms.TextBox() Me.textBox3 = New System.Windows.Forms.TextBox() Me.label1 = New System.Windows.Forms.Label() Me.label2 = New System.Windows.Forms.Label() Me.label3 = New System.Windows.Forms.Label() ' ' textBox1 ' Me.textBox1.Location = New System.Drawing.Point(64, 8) Me.textBox1.Size = New System.Drawing.Size(104, 25) Me.textBox1.Text = "" ' ' textBox2 ' Me.textBox2.Location = New System.Drawing.Point(64, 40) Me.textBox2.Size = New System.Drawing.Size(104, 25) Me.textBox2.Text = "" ' ' textBox3 ' Me.textBox3.Location = New System.Drawing.Point(64, 72) Me.textBox3.Size = New System.Drawing.Size(104, 25) Me.textBox3.Text = "" ' ' label1 ' Me.label1.Location = New System.Drawing.Point(8, 8) Me.label1.Size = New System.Drawing.Size(56, 22) Me.label1.Text = "Name" ' ' label2 ' Me.label2.Location = New System.Drawing.Point(8, 40) Me.label2.Size = New System.Drawing.Size(56, 22) Me.label2.Text = "Phone" ' ' label3 ' Me.label3.Location = New System.Drawing.Point(8, 72) Me.label3.Size = New System.Drawing.Size(56, 22) Me.label3.Text = "City" ' ' Form1 ' Me.Controls.Add(textBox1) Me.Controls.Add(textBox2) Me.Controls.Add(textBox3) Me.Controls.Add(label1) Me.Controls.Add(label2) Me.Controls.Add(label3) Me.Menu = Me.mainMenu1 Me.Text = "Input Mode Demo" End Sub Shared Sub Main() Application.Run(New Form1()) End Sub Private Sub mi1_Click(sender As Object, e As EventArgs) Me.Close() End Sub End Class
Windows Mobile for Smartphone
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.