InputLanguage Class
Provides methods and fields to manage the input language. This class cannot be inherited.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
An input language is a culture/keyboard layout pair that determines how the physical keys on a keyboard map or plot to characters in a language. The input language is based on a Windows input locale identifier, such as that returned by the Platform SDK function, GetKeyboardLayout. The input locale identifier is also called a handle to a keyboard layout (HKL) value.
Use the static methods provided to find all installed mappings of the system and to change the input language for a thread or process. Call CurrentInputLanguage to get the current input language. Call DefaultInputLanguage for the default input language. Call InstalledInputLanguages to get all the installed languages in this system. After you have a list of all the installed languages, use CurrentInputLanguage to change the current input language to a different language.
The following code example gets a list of installed languages. The example requires that textBox1 has been instantiated and that textBox1.MultiLine has been set to true.
The next example sets the default input language as the current input language. The example requires that textBox1 has been instantiated and that textBox1.MultiLine has been set to true.
Public Sub SetNewCurrentLanguage() ' Gets the default, and current languages. Dim myDefaultLanguage As InputLanguage = InputLanguage.DefaultInputLanguage Dim myCurrentLanguage As InputLanguage = InputLanguage.CurrentInputLanguage textBox1.Text = "Current input language is: " & _ myCurrentLanguage.Culture.EnglishName & ControlChars.Cr textBox1.Text &= "Default input language is: " & _ myDefaultLanguage.Culture.EnglishName & ControlChars.Cr ' Changes the current input language to the default, and prints the new current language. InputLanguage.CurrentInputLanguage = myDefaultLanguage textBox1.Text &= "Current input language is now: " & _ myDefaultLanguage.Culture.EnglishName End Sub 'SetNewCurrentLanguage
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.