.Net Tip: Get and Set The User's Keyboard Layouts
Have you ever wanted to know what keyboard layouts are installed on your user's host? Have you ever wanted to set the keyboard layout in your form? .Net makes it easy for you!
How do you do that? here it is:
Get the installed layouts:
foreach (InputLanguage layout in InputLanguage.InstalledInputLanguages)
{
Console.WriteLine(layout.LayoutName);
}
Set the layout
// This will set the keyboard layout to Hebrew
InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(new System.Globalization.CultureInfo("he"));
The InputLanguage class is very handy in some cases, use it!
All the best,
Shay