# Checking on Demand

> Open a spelling dialog from a button in Windows Forms: TextControl.SpellCheckDialog, SpellCheckDialog.Show for TX Text Control, and Check for a RichTextBox.

- **Product:** TX Spell .NET for Windows Forms
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Spell .NET for Windows Forms > Spell Checking > Checking on Demand
- **1699 words**
- **Web URL:** https://docs.textcontrol.com/tx-spell-dotnet-winforms/spell-checking/on-demand/
- **LLMs URL:** https://docs.textcontrol.com/tx-spell-dotnet-winforms/spell-checking/on-demand/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-spell-dotnet-winforms/spell-checking/on-demand/llms-full.txt

---

Many applications check spelling when the user asks for it: a **Spelling** button, a menu item, or a check before a document is saved or sent. The user then walks through the misspelled words one by one in a dialog, choosing a suggestion or ignoring the word each time. With TX Spell .NET for Windows Forms, that dialog opens with one line of code, for TX Text Control as well as for a `RichTextBox` or any other control.

### Two Dialogs to Choose From

When a spell checker is connected to a `TextControl`, two spelling dialogs are available. Both walk through the same misspelled words; they differ in who opens them and whether you can change them:

|  | Dialog of TX Text Control | Dialog of TX Spell .NET |
|---|---|---|
| Opened by | [TextControl.SpellCheckDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/spellcheckdialog-method/llms-full.txt), or **Spell Check Dialog...** in the context menu | [SpellCheckDialog.Show](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/spellcheckdialog/show-method/llms-full.txt) |
| Works with | TX Text Control only | TX Text Control and any other control |
| Can be customized | No, it is preconfigured | Yes: buttons, texts, font and behavior |
| Raises [MisspelledWordChanging](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/misspelledwordchanging-event/llms-full.txt) for each change | No | Yes |

Choose the dialog of TX Text Control when the preconfigured one is all you need. Choose the dialog of TX Spell .NET to change it, to check several controls in one pass, or to check a control other than TX Text Control.

### Open the Dialog of TX Text Control

The `SpellCheckDialog` method of the `TextControl` steps through all misspelled words of the document: the main text first, then the headers, footers and text frames. It is available only when a spell checker is connected through the [SpellChecker](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/spellchecker-property/llms-full.txt) property, as [As-You-Type Checking](https://docs.textcontrol.com/tx-spell-dotnet-winforms/spell-checking/as-you-type/llms-full.txt) shows. Call it from a button or menu item:

```csharp
private void buttonSpelling_Click(object sender, EventArgs e)
{
    textControl1.SpellCheckDialog();
}
```

An overload takes the dictionary the dialog creates suggestions from. It is useful only when more than one dictionary has been added to the spell checker.

With the ribbon of TX Text Control, you don't need this code for the user to start a check. The **Proofing** tab, a [RibbonProofingTab](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms-ribbon/ribbonproofingtab/llms-full.txt), holds the spelling and hyphenation buttons, next to the groups for comments and tracked changes. Apart from the button that sets the language, its proofing buttons are enabled only when the `TextControl` has a spell checker connected:

![The Proofing tab of the ribbon in TX Text Control Words, with Enable Spell Checking, Enable Hyphenations, Thesaurus and Spelling in the Spelling & Hyphenation group.](https://docs.textcontrol.com/assets/img/tx-spell-dotnet-winforms/ribbon-proofing-tab.748b5cc8.webp)

### Open the Dialog of TX Spell .NET

The [SpellCheckDialog](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/spellcheckdialog-property/llms-full.txt) property of the [TXSpellChecker](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/llms-full.txt) returns the dialog of TX Spell .NET, a [SpellCheckDialog](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/spellcheckdialog/llms-full.txt). To check a `TextControl`, pass it to `Show`:

```csharp
private void buttonSpelling_Click(object sender, EventArgs e)
{
    txSpellChecker1.SpellCheckDialog.Show(textControl1);
}
```

No further code is needed for TX Text Control: the dialog finds the misspelled words and applies the user's corrections to the document itself.

![The Spelling dialog over a TextControl: the sentence with the misspelled word "sampke" in red, the suggestions sample, spake and smoke, the buttons Ignore Once, Ignore All, Add To Dictionary, Change and Change All, the Suggestions Dictionary en_US.dic, Options and Cancel.](https://docs.textcontrol.com/assets/img/tx-spell-dotnet-winforms/textcontrol-spelling-dialog.1c62f1f3.webp)

The dialog shows the misspelled word in its sentence, with the language of the word above it. The user picks a suggestion and clicks **Change** or **Change All**, or skips the word with **Ignore Once** or **Ignore All**. **Add To Dictionary** puts the word into a user dictionary, and the **Suggestions Dictionary** list chooses which dictionary the suggestions come from. [Spell Check Dialog](https://docs.textcontrol.com/tx-spell-dotnet-winforms/user-interface/spell-check-dialog/llms-full.txt) describes every part of it, and [Customizing the Spell Check Dialog](https://docs.textcontrol.com/tx-spell-dotnet-winforms/user-interface/customizing-dialog/llms-full.txt) shows how to change it.

`Show` has four overloads:

| Overload | Checks |
|---|---|
| `Show(object textControl)` | The `TextControl` you pass |
| `Show(object textControl, Dictionary suggestionDictionary)` | The same, with suggestions from the [Dictionary](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/dictionary/llms-full.txt) you pass |
| `Show()` | The words in [IncorrectWords](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/incorrectwords-property/llms-full.txt), found by a call to `Check` before |
| `Show(Dictionary suggestionDictionary)` | The same, with suggestions from the dictionary you pass |

### Check a RichTextBox in the Dialog

The dialog can walk through the words of any text, but only TX Text Control applies the corrections itself. For another control, call the spell checker's [Create](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/create-method/llms-full.txt) method once, pass the text of the control to [Check](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/check-method/llms-full.txt) and open the dialog with `Show()`. Each time the user changes or deletes a word, the [IncorrectWordChanging](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/incorrectwordchanging-event/llms-full.txt) event fires, and your handler makes the same change in the control. Don't call `Check` while the dialog is open: it throws an exception.

[Open the Spell Check Dialog](https://docs.textcontrol.com/tx-spell-dotnet-winforms/getting-started/richtextbox/dialog/llms-full.txt) builds this for a `RichTextBox` step by step and explains the handler, and the *RichTextBox\\SpellCheckDialog* sample of the setup works the same way. [Events](https://docs.textcontrol.com/tx-spell-dotnet-winforms/spell-checking/events/#apply-or-cancel-a-change) lists what else the handler's arguments carry, such as a `Cancel` property that stops the change.

### Control When the Dialog Closes

Two properties of the `SpellCheckDialog`, `CloseOnFinished` and `ShowMessageBoxes`, decide whether the dialog closes and what it tells the user when the last word is handled; [Decide How a Check Ends](https://docs.textcontrol.com/tx-spell-dotnet-winforms/user-interface/spell-check-dialog/#decide-how-a-check-ends) describes them. To check several controls in one dialog, keep it open in the `SpellCheckDialogClosing` event, as [Checking Multiple Controls](https://docs.textcontrol.com/tx-spell-dotnet-winforms/spell-checking/multiple-controls/llms-full.txt) shows.

### Next Steps

- [Checking Multiple Controls](https://docs.textcontrol.com/tx-spell-dotnet-winforms/spell-checking/multiple-controls/llms-full.txt): walk through several editors with one dialog.
- [Checking Text Parts](https://docs.textcontrol.com/tx-spell-dotnet-winforms/spell-checking/text-parts/llms-full.txt): check only the headers, footers or text frames you choose.
- [Customizing the Spell Check Dialog](https://docs.textcontrol.com/tx-spell-dotnet-winforms/user-interface/customizing-dialog/llms-full.txt): add, remove and rename buttons.
- [Events](https://docs.textcontrol.com/tx-spell-dotnet-winforms/spell-checking/events/llms-full.txt): react to every change the dialog makes.

---

## Nearby

- **Previous:** [As-You-Type Checking](https://docs.textcontrol.com/tx-spell-dotnet-winforms/spell-checking/as-you-type/llms-full.txt)
- **Next:** [Incorrect Words and Suggestions](https://docs.textcontrol.com/tx-spell-dotnet-winforms/spell-checking/suggestions/llms-full.txt)
