Spell Checking Examples
Checking spelling as the user types, walking through a document in the spell check dialog and offering suggestions in a context menu: the samples below show each of these with TX Spell .NET for Windows Forms, in TX Text Control and in the standard text controls of Windows Forms. Most of them come with the setup; the others are repositories on GitHub and articles of the Text Control Blog.
Samples of the Setup
The setup installs these samples in C# and Visual Basic, below TX Spell 11.0.NET for Windows Forms\Samples\WinForms in your Documents folder, in the folder CSharp or VB.NET. Each is a Windows Forms project with a TXSpellChecker component on the form.
With TX Text Control
| Example | What it shows | Where |
|---|---|---|
| Simple | A spell checker connected to a TextControl, which marks misspelled words as the user types | TextControl\Simple |
| Context menu | A context menu of your own with the suggestions for a misspelled word, from GetMenuItems | TextControl\Context menu strip |
| Spell check dialog | The SpellCheckDialog of TX Spell .NET, which you can customize, instead of the dialog of TX Text Control | TextControl\SpellCheckDialog |
| Several controls | One TXSpellChecker for several TextControl instances | TextControl\Multiple controls |
| Dialog for several controls | One spell check dialog that walks through four TextControl instances and their text parts, switching controls in SpellCheckDialogClosing | TextControl\SpellCheckDialog on multiple controls |
| Dialog for chosen text parts | Check boxes choose which text parts the dialog checks: the main text, headers, footers and text frames, through the SpellCheckDialogStateManager | TextControl\SpellCheckDialog on specific text parts |
| Correction user interface | A user interface of your own for corrections, bound to the SpellingCorrectionUIProvider, in a simple and an advanced version | TextControl\SpellingCorrectionUIProvider |
| Modified dialog | Buttons added to, removed from and changed in the spell check dialog through its DialogButtonCollection, another font and an options dialog of your own | Modify SpellCheckDialog |
With RichTextBox and TextBox
| Example | What it shows | Where |
|---|---|---|
| Spell check dialog | Check finds the misspelled words of a RichTextBox, and the spell check dialog shows them | RichTextBox\SpellCheckDialog |
| Context menu | Suggestions in the context menu of a RichTextBox | RichTextBox\Context menu strip |
| Several controls | One spell checker for several RichTextBox controls, which checks each one when its text changes | RichTextBox\Multiple controls |
| Dialog for several controls | One spell check dialog for four RichTextBox controls | RichTextBox\SpellCheckDialog on multiple controls |
| Check simple text | The text of a TextBox, checked on demand with Check of the TXSpellChecker and when the control is validated | Check simple text |
Getting Started builds the first of these samples step by step.
GitHub Samples
Three repositories on GitHub show spell checking beyond the samples of the setup: AutoCorrect of two initial capitals and interactive suggestions below a misspelled word in TX Text Control, and the validation of a form field in ASP.NET Web Forms with the TXSpell class. The Repositories describes them with the versions they were written for, and shows how to update an older one.
Blog Articles With Code
These articles contain their code, without a repository. They were written for earlier versions; check the members they use in the reference:
| Example | What it shows | Where |
|---|---|---|
| AutoCorrect | A misspelled word replaced with its first suggestion when the user types a delimiter | AutoCorrect Using TX Text Control and TX Spell .NET |
| AutoText and AutoCorrect on a key | Abbreviations that TX Spell .NET reports as misspelled replaced with their full text from the Changed event, and the misspelled word at the input position replaced with its first suggestion when the user presses Ctrl+Space, both through MisspelledWordCollection.Remove | Implementing AutoText with TX Text Control and TX Spell .NET |
| One spell checker for several editors | A single TXSpellChecker shared by several TextControl instances | Share a Single TXSpellChecker Instance Across Multiple TextControls |
| Custom context menus | The context menu of misspelled words in TX Text Control, built by your own code | TX Spell .NET: Creating Custom Context Menus |
| Spell checking without a user interface | TXSpell connected to a ServerTextControl, which processes documents without a user interface | Using TX Spell .NET with ServerTextControl |
Next Steps
- Dictionary and Language Examples: dictionaries, hyphenation, synonyms and language detection.
- Spell Checking: the ways to check spelling, explained.
- Customizing the Spell Check Dialog: change the dialog to fit your application.