1

How do I enable German (Live) Spell Checking in textBoxes for my Windows Forms Application? I already tried this:

        System.Windows.Controls.SpellCheck.SetIsEnabled(tb_HZ1, true);

Where tb_HZ1 is my TextBox. But all I get then is the following error messages:

Error   1   The best overloaded method match for 'System.Windows.Controls.SpellCheck.SetIsEnabled(System.Windows.Controls.Primitives.TextBoxBase, bool)' has some invalid arguments C:\Users\Andrej\documents\visual studio 2012\Projects\Fanreport Game Report Creator\Fanreport Game Report Creator\Form1.cs  15  13  Fanreport Game Report Creator

Error   2   Argument 1: cannot convert from 'System.Windows.Forms.TextBox' to 'System.Windows.Controls.Primitives.TextBoxBase'  C:\Users\Andrej\documents\visual studio 2012\Projects\Fanreport Game Report Creator\Fanreport Game Report Creator\Form1.cs  15  61  Fanreport Game Report Creator
Sam
  • 7,252
  • 16
  • 46
  • 65
user197915
  • 13
  • 1
  • 3
  • 1
    The [`SpellCheck` class](http://msdn.microsoft.com/en-us/library/system.windows.controls.spellcheck(v=vs.100).aspx) is in the `PresentationFramework.dll` what is [WPF](http://de.wikipedia.org/wiki/Windows_Presentation_Foundation) not winforms, so that doesn't work. http://stackoverflow.com/questions/4024798/trying-to-use-the-c-sharp-spellcheck-class – Tim Schmelter Aug 10 '13 at 23:19

1 Answers1

2

You can try this: http://spellchecktextbox.codeplex.com . It uses the WPF control as a base.

//to answer your comment:

  1. open the tool project and build it.
  2. In your project right click the tool box(I usually do it under general.)
  3. Click choose items.
  4. Browse to TextBoxSource\obj\Debug
  5. Add the DLL ExtendedTextBox.dll

Also If the tool project is in another solution you will need to add the DLL to your references folder as well.

Edit: I just realized you said you wanted German spell check. You will need to change this in the control project. Change:

 <TextBox SpellCheck.IsEnabled="True" Name="theTextBox" AcceptsReturn="True" AcceptsTab="True" Text="" Cursor="IBeam" CaretBrush="#E6000000" />

to something like

<TextBox SpellCheck.IsEnabled="True" Name="theTextBox" AcceptsReturn="True" AcceptsTab="True" Text="" Cursor="IBeam" CaretBrush="#E6000000" xml:lang="German Culture Code here"/>
Aaron
  • 1,361
  • 1
  • 13
  • 30