Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

InputLanguage.FromCulture Method

Returns the input language associated with the specified culture.

[Visual Basic]
Public Shared Function FromCulture( _
   ByVal culture As CultureInfo _
) As InputLanguage
[C#]
public static InputLanguage FromCulture(
 CultureInfo culture
);
[C++]
public: static InputLanguage* FromCulture(
 CultureInfo* culture
);
[JScript]
public static function FromCulture(
   culture : CultureInfo
) : InputLanguage;

Parameters

culture
The CultureInfo object that specifies the culture to convert from.

Return Value

An InputLanguage that represents the previously selected input language.

Example

[Visual Basic, C#, C++] The following example sets the default input language as the current input language.

[Visual Basic, C#, C++] First, DefaultInputLanguage is called to get the system default language. Next, CurrentInputLanguage is called to get the current input language. The results are printed in a text box. Then, calling CurrentInputLanguage with the default input language changes the current input language to the default. The new current input language is displayed in a text box.

[Visual Basic, C#, C++] This code assumes that textBox1 has been instantiated.

[Visual Basic] 
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
       
   'Print the new current input language.
   Dim myCurrentLanguage2 As InputLanguage = InputLanguage.CurrentInputLanguage
   textBox1.Text &= "New current input language is: " & _
       myCurrentLanguage2.Culture.EnglishName
End Sub


[C#] 
public void SetNewCurrentLanguage() {
   // Gets the default, and current languages.
   InputLanguage myDefaultLanguage = InputLanguage.DefaultInputLanguage;
   InputLanguage myCurrentLanguage = InputLanguage.CurrentInputLanguage;
   textBox1.Text = "Current input language is: " +
       myCurrentLanguage.Culture.EnglishName + '\n';
   textBox1.Text += "Default input language is: " +
       myDefaultLanguage.Culture.EnglishName + '\n';

   //Print the new current input language.
   InputLanguage myCurrentLanguage2 = InputLanguage.CurrentInputLanguage;
   textBox1.Text += "New current input language is: " +
       myCurrentLanguage2.Culture.EnglishName;
}


[C++] 
public:
 void SetNewCurrentLanguage() {
    // Gets the default, and current languages.
    InputLanguage* myDefaultLanguage = InputLanguage::DefaultInputLanguage;
    InputLanguage* myCurrentLanguage = InputLanguage::CurrentInputLanguage;
    textBox1->Text = String::Format( S"{0}Current input language is: {1}\n",
        myCurrentLanguage->Culture->EnglishName, myDefaultLanguage->Culture->EnglishName );
 
    //Print the new current input language.
    InputLanguage* myCurrentLanguage2 = InputLanguage::CurrentInputLanguage;
    textBox1->Text = String::Format( S"{0}New current input language is: {1}",
        textBox1->Text, myCurrentLanguage2->Culture->EnglishName );
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

InputLanguage Class | InputLanguage Members | System.Windows.Forms Namespace | DefaultInputLanguage | CurrentInputLanguage | Equals

Show:
© 2015 Microsoft