# TXSpellChecker

> Put TXSpellChecker on a Windows Forms form, connect it to TextControl through SpellChecker or check a RichTextBox with Check, and find its key members by task.

- **Product:** TX Spell .NET for Windows Forms
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Spell .NET for Windows Forms > Overview > Components > TXSpellChecker
- **2696 words**
- **Web URL:** https://docs.textcontrol.com/tx-spell-dotnet-winforms/overview/components/txspellchecker/
- **LLMs URL:** https://docs.textcontrol.com/tx-spell-dotnet-winforms/overview/components/txspellchecker/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-spell-dotnet-winforms/overview/components/txspellchecker/llms-full.txt

---

`TXSpellChecker` is the component of TX Spell .NET for Windows Forms that you put on a form. It checks the text of a TX Text Control editor as the user types, checks the text of other controls on request, and brings the spell check dialog, the options dialog and the items of the spell check context menu. What follows describes what it does, how it connects to your controls and which members you use most.

### What TXSpellChecker Is

The class is `TXTextControl.Proofing.TXSpellChecker`, derived from `System.ComponentModel.Component`. It has no user interface of its own: dropped on a form, it appears as *txSpellChecker1* in the component tray below the form, and its dialogs and menus open only when a user or your code asks for them.

It comes with the NuGet package `TXTextControl.TXSpell.WinForms.SDK`, in the assembly *TXSpell.Windows.Forms.dll*. The package adds it to the Visual Studio toolbox, on the tab **TXSpell 11.0**, and brings the US English dictionary, hyphenation list and thesaurus with it.

### What You Do With It

- **Check TX Text Control as the user types.** Connected to a `TextControl`, it underlines misspelled words with a red zigzag line and offers corrections in the context menu. [As-You-Type Checking](https://docs.textcontrol.com/tx-spell-dotnet-winforms/spell-checking/as-you-type/llms-full.txt)
- **Check any other control.** [Check](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/check-method/llms-full.txt) finds the misspelled words of a text, such as the text of a `RichTextBox` or a `TextBox`. [Checking on Demand](https://docs.textcontrol.com/tx-spell-dotnet-winforms/spell-checking/on-demand/llms-full.txt)
- **Walk the user through the misspelled words.** Its spell check dialog and options dialog are built in. [Spell Check Dialog and Options Dialog](https://docs.textcontrol.com/tx-spell-dotnet-winforms/overview/components/dialogs/llms-full.txt)
- **Offer suggestions.** For a context menu of your own, a list or a dialog. [Context Menu and Suggestion Controls](https://docs.textcontrol.com/tx-spell-dotnet-winforms/overview/components/context-menu/llms-full.txt)
- **Hyphenate, look up synonyms and detect languages**, with the same language data. [Hyphenation](https://docs.textcontrol.com/tx-spell-dotnet-winforms/hyphenation/llms-full.txt), [Language Detection](https://docs.textcontrol.com/tx-spell-dotnet-winforms/dictionaries/language-detection/llms-full.txt)

One `TXSpellChecker` serves every control of a form: the dictionaries are loaded once, and a word the user adds to a user dictionary counts in all editors. [Checking Multiple Controls](https://docs.textcontrol.com/tx-spell-dotnet-winforms/spell-checking/multiple-controls/llms-full.txt) shows how.

### How You Connect It

To TX Text Control, the spell checker connects through the [SpellChecker](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/spellchecker-property/llms-full.txt) property of the `TextControl`, in the designer or in code, and then initializes itself; the underlines, the context menu and the corrections work without further code. [As-You-Type Checking](https://docs.textcontrol.com/tx-spell-dotnet-winforms/spell-checking/as-you-type/llms-full.txt) shows both ways.

A `RichTextBox`, a `TextBox` or any other control doesn't talk to the spell checker itself: your code calls [Create](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/create-method/llms-full.txt) once, passes the text to `Check` and applies the corrections in the [IncorrectWordChanging](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/incorrectwordchanging-event/llms-full.txt) event. [RichTextBox and TextBox](https://docs.textcontrol.com/tx-spell-dotnet-winforms/integration/richtextbox/llms-full.txt) describes this integration.

### Example

This form has a `TextControl` and a **Spelling...** button. The spell checker underlines misspelled words and hyphenates the text as the user types, and the button opens the spell check dialog. It creates its controls in code, so it runs in a new Windows Forms project with the TX Text Control and TX Spell .NET packages:

```csharp
using System;
using System.Windows.Forms;
using TXTextControl;
using TXTextControl.Proofing;

public class Form1 : Form
{
    private readonly TextControl textControl1 = new TextControl();
    private readonly TXSpellChecker txSpellChecker1 = new TXSpellChecker();
    private readonly System.Windows.Forms.Button buttonSpelling = new System.Windows.Forms.Button();

    public Form1()
    {
        textControl1.Dock = DockStyle.Fill;
        buttonSpelling.Dock = DockStyle.Bottom;
        buttonSpelling.Text = "Spelling...";
        Controls.Add(textControl1);
        Controls.Add(buttonSpelling);

        // Connect the spell checker: misspelled words are underlined as the user types
        textControl1.SpellChecker = txSpellChecker1;
        textControl1.IsSpellCheckingEnabled = true;
        textControl1.IsHyphenationEnabled = true;

        // Open the spell check dialog of TX Spell .NET for this TextControl
        buttonSpelling.Click += (sender, e) => txSpellChecker1.SpellCheckDialog.Show(textControl1);
    }

    [STAThread]
    private static void Main()
    {
        Application.EnableVisualStyles();
        Application.Run(new Form1());
    }
}
```

The code works as follows:

- `System.Windows.Forms.Button` is written in full because the `TXTextControl` namespace has a `Button` class, too.
- `SpellChecker`, `IsSpellCheckingEnabled` and [IsHyphenationEnabled](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/ishyphenationenabled-property/llms-full.txt) connect the spell checker and switch on checking and hyphenation.
- [SpellCheckDialog](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/spellcheckdialog-property/llms-full.txt) returns the spell check dialog; `Show` opens it for the `TextControl`.

[Create Your First Windows Forms Application](https://docs.textcontrol.com/tx-spell-dotnet-winforms/getting-started/tx-text-control/first-application/llms-full.txt) builds the same application in the designer, step by step.

### Key Members

| Group | Members | Purpose |
|---|---|---|
| Checking | [Check](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/check-method/llms-full.txt), [IncorrectWords](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/incorrectwords-property/llms-full.txt), [IgnoreWord](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/ignoreword-property/llms-full.txt), [IgnoreCase](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/ignorecase-property/llms-full.txt) | Find misspelled words, and choose which words are skipped |
| Suggestions | [CreateSuggestions](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/createsuggestions-method/llms-full.txt), [Suggestions](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/suggestions-property/llms-full.txt) | Create the corrections for a word |
| Dictionaries | [Dictionaries](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/dictionaries-property/llms-full.txt), [Language](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/language-property/llms-full.txt), [AvailableDictionaries](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/availabledictionaries-property/llms-full.txt) | Load dictionaries and user dictionaries, and choose the default one |
| Hyphenation | [GetHyphenationPoints](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/gethyphenationpoints-method/llms-full.txt), [HyphenationLists](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/hyphenationlists-property/llms-full.txt), [HyphenationLanguage](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/hyphenationlanguage-property/llms-full.txt) | Hyphenate words |
| Synonyms | [CreateSynonyms](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/createsynonyms-method/llms-full.txt), [SynonymLists](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/synonymlists-property/llms-full.txt) | Look up synonyms |
| Language detection | [DetectLanguageScopes](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/detectlanguagescopes-method/llms-full.txt), [DetectableLanguageScopes](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/detectablelanguagescopes-property/llms-full.txt) | Find out in which language a text is written |
| User interface | [SpellCheckDialog](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/spellcheckdialog-property/llms-full.txt), [OptionsDialog](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/optionsdialog-method/llms-full.txt), [GetMenuItems](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/getmenuitems-method/llms-full.txt), [SpellingCorrectionUIProvider](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/spellingcorrectionuiprovider-property/llms-full.txt) | Open the dialogs, build menus and correction panels |
| Events | [IncorrectWordChanging](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/incorrectwordchanging-event/llms-full.txt), [MisspelledWordChanging](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/misspelledwordchanging-event/llms-full.txt), [SpellCheckDialogClosing](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/spellcheckdialogclosing-event/llms-full.txt), [UserDictionaryWordAdded](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/userdictionarywordadded-event/llms-full.txt) | React to corrections, the dialog and the dictionaries |
| Language data folders | [DictionariesDirectoryPath](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/dictionariesdirectorypath-property/llms-full.txt), [HyphenationListsDirectoryPath](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/hyphenationlistsdirectorypath-property/llms-full.txt), [SynonymListsDirectoryPath](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/synonymlistsdirectorypath-property/llms-full.txt), [LanguageRecognitionDirectoryPath](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/languagerecognitiondirectorypath-property/llms-full.txt) | Read the language data from other folders than the defaults |

[Events](https://docs.textcontrol.com/tx-spell-dotnet-winforms/spell-checking/events/llms-full.txt) lists all events, and the [TXSpellChecker](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/llms-full.txt) reference all members.

### Next Steps

- [Create Your First Windows Forms Application](https://docs.textcontrol.com/tx-spell-dotnet-winforms/getting-started/tx-text-control/first-application/llms-full.txt): a word processor with spell checking.
- [TXSpell](https://docs.textcontrol.com/tx-spell-dotnet-winforms/overview/components/txspell/llms-full.txt): the same checks without a user interface.
- [Spell Check Dialog and Options Dialog](https://docs.textcontrol.com/tx-spell-dotnet-winforms/overview/components/dialogs/llms-full.txt): the dialogs of the component.
- [Loading and Managing Dictionaries](https://docs.textcontrol.com/tx-spell-dotnet-winforms/dictionaries/managing/llms-full.txt): other languages and user dictionaries.

---

## Nearby

- **Previous:** [Components](https://docs.textcontrol.com/tx-spell-dotnet-winforms/overview/components/llms-full.txt)
- **Next:** [Spell Check Dialog and Options Dialog](https://docs.textcontrol.com/tx-spell-dotnet-winforms/overview/components/dialogs/llms-full.txt)
