Provides methods and fields to manage the input language.
Object
InputLanguage
[Visual Basic] Public Class InputLanguage [C#] public class InputLanguage [C++] public __gc class InputLanguage [JScript] public class InputLanguage
An input language is a culture-keyboard layout pair that determines how the physical keys on a keyboard map to characters in a language.
You can not create an instance of this class. Use the static (in Visual Basic Shared) methods provided to find all of the system's installed mappings and to change the input language for a thread or process. Call GetCurrentInputLanguage to get the current input language. Call GetDefaultInputLanguage for the default input language. Call GetInstalledInputLanguages to get all the installed languages in this system. Once you have a list of all the installed languages, use SetCurrentInputLanguage to change the current input language to a different language. Use SelectNext to set the current input language to the next language on the language list.
Namespace: System.WinForms
Assembly: System.WinForms.dll
The following example gets a list of installed languages. It assumes that TextBox1 has been instantiated.
[C#]
public void GetLanguages() { //Get the list of installed languages. InputLanguage[] myLanguages = InputLanguage.GetInstalledInputLanguages(); //Extract the culture from each language object and display it. for (int i=0; i<myLanguages.Length; i++) textBox1.Text += myLanguages[i].GetCulture().EnglishName + '\n'; }
The following example sets the default input language as the current input language. It assumes that TextBox1 has been instantiated.
[C#]
public void SetNewCurrentLanguage() { //Get the default and current languages. InputLanguage myDefaultLanguage = InputLanguage.GetDefaultInputLanguage(); InputLanguage myCurrentLanguage = InputLanguage.GetCurrentInputLanguage(); textBox1.Text = "Current input language is: " + myCurrentLanguage.GetCulture().EnglishName + '\n'; textBox1.Text += "Default input language is: " + myDefaultLanguage.GetCulture().EnglishName + '\n'; //Change the current input language to the default and print the new current language. InputLanguage.SetCurrentInputLanguage(myDefaultLanguage, 0); textBox1.Text += "Current input language is now: " + myCurrentLanguage.GetCulture().EnglishName; }