)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to enable WinForms SpellChecker (SpellCheckerAdv) control for different languages based on system configuration?

Platform: WinForms |
Control: SpellChecker |
Published Date: November 20, 2014 |
Last Revised Date: January 23, 2020

Enable SpellChecker control

1. The SpellChecker control helps to check the spelling with different languages.

2. Spell check with different languages can be done by getting input language of the system.

3. Input languages can be detected by using InputLanguageChanged event handler.

4. CurrentInputLanguage is used to get the Culture Name by string.

5. Dictionary path can be set by using DictionaryPath properties for the required languages.

6. Custom path can be set by using CustomDictionaryPath for your requirements.

C#

//Detect Input language
void Form1_InputLanguageChanged(object sender, InputLanguageChangedEventArgs e)
{
   MessageBox.Show(e.InputLanguage.Culture.TextInfo.CultureName);
}
private void button1_Click(object sender, EventArgs e)
{
   string str = InputLanguage.CurrentInputLanguage.Culture.TextInfo.CultureName;
   if (str == "en-US")
   {
      this.spellChecker1.DictionaryPath = @"..\..\en_us.dic";
   }
   // To get Spanish language spell check
   else if (str == "es-ES")
   {
      this.spellChecker1.DictionaryPath = @"..\..\Spanish.dic";
   }
   //To get German-Germany language spell check
   else if (str == "de-DE")
   {
      this.spellChecker1.DictionaryPath = @"..\..\Germany.dic";
   }
   // To get Portuguese - Brazil language spell check
   else if (str == "pt-BR")
   {
      this.spellChecker1.DictionaryPath = @"..\..\Brazil.dic";
   }
   this.spellChecker1.SpellCheck(new SpellEditorWrapper(this.richTextBox1));
}

VB

‘Detect Input languagePrivate Sub Form1_InputLanguageChanged(ByVal sender As Object, ByVal e As InputLanguageChangedEventArgs)      MessageBox.Show(e.InputLanguage.Culture.TextInfo.CultureName)End SubPrivate Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
   Dim str As String = InputLanguage.CurrentInputLanguage.Culture.TextInfo.CultureName
      If (str = "en-US") Then
          Me.spellChecker1.DictionaryPath = "..\..\en_us.dic"
      End If
      ‘To get Spanish language spell check
      If (str = "es-ES") Then
          Me.spellChecker1.DictionaryPath = "..\..\Spanish.dic"
      End If
      ’To get German-Germany language spell check
      If (str = "de-DE") Then
          Me.spellChecker1.DictionaryPath = "..\..\Germany.dic"
      End If
      ‘To get Portuguese - Brazil language spell check
      If (str = "pt-BR") Then
          Me.spellChecker1.DictionaryPath = "..\..\Brazil.dic"
      End If
      Me.spellChecker1.SpellCheck(New SpellEditorWrapper(Me.richTextBox1))
  End Sub

Sample: http://www.syncfusion.com/downloads/support/directtrac/general/SpellChecker-1877667165.zip

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon