Set Selected Language as Input Language in Windows Form

Step 1: Create new winform application and design form with labels, combobox and textbox control as below.

 

Step 2: Write below code.

  1. using System;  
  2. using System.Windows.Forms;  
  3. namespace LanguageDemo  
  4. {  
  5.     public partial class Form1: Form  
  6.     {  
  7.         public Form1()  
  8.         {  
  9.             InitializeComponent();  
  10.         }  
  11.         private void Form1_Load(object sender, EventArgs e)  
  12.         {  
  13.             foreach(InputLanguage lng in InputLanguage.InstalledInputLanguages)  
  14.             {  
  15.                 comboBox1.Items.Add(lng.Culture.DisplayName);  
  16.             }  
  17.             comboBox1.SelectedIndex = 0;  
  18.         }  
  19.         private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)  
  20.         {  
  21.             foreach(InputLanguage lng in InputLanguage.InstalledInputLanguages)  
  22.             {  
  23.                 if (lng.Culture.DisplayName == comboBox1.Text)  
  24.                 {  
  25.                     InputLanguage.CurrentInputLanguage = lng;  
  26.                 }  
  27.             }  
  28.         }  
  29.     }  
  30. }  

In above code, in form load event we get all installed languages from InputLanguage class and fill it in combobox.

Then in selected index changed event of combobox we set selected language as input language. To set input language we set CurrentInputLanguage property of InputLanguage class.

Step 3: Run your application. Here two languages are installed on my computer.

 

Step 4: Change input language from combobox and type in textbox and check output.

 
Ebook Download
View all
Learn
View all