Wintertree Software Inc.

Sentry Spell Checker for Visual Basic

Home Site index Contact us Catalog Shopping Cart Products Support Search

You are here: Home > Add a spell checker to your applications > Visual Basic > Using Sentry Spell Checker


Add a spell checker to your Visual Basic applications with Sentry Spell Checker

Sentry Spelling Checker provides everything you need to add a full spellcheck capability to your VB applications. Click here to find out more about Sentry Spelling Checker Engine Windows SDK.

Click on a topic below to find out more about how Sentry Spell Checker works with your Visual Basic applications:


How to interactively spell check a TextBox, RichTextBox, or TX Text Control

Many Visual Basic applications let their users enter text via a TextBox, RichTextBox, or TX Text Control on a form. If this is how your application works, you can add a spellchecker in minutes using these simple steps:

  1. Set the Hide Selection property of the TextBox, RichTextBox, or TX Text Control to False. This lets Sentry Spell Checker highlight any misspelled words found.

  2. Add a "Spell check" button or menu item to your Visual Basic form.
  3. In the event handler for your "Spell check" button or menu item, pass the HWnd property of your text box to Sentry's CheckCtrlDlg function.

The Sentry DLL includes a built in spellcheck dialog box that lets you add spellchecking to your VB app in as little as one line of code!

That's all there is to it! When the "Spell check" button or menu item is pressed, Sentry will check the spelling of words in the text box. If a misspelled word is found, Sentry will pop up a dialog the user can interact with to dispose of the misspelling. The misspelled word will be highlighted in the text box. The dialog shows suggested replacements for the misspelled word. If the user makes a correction, the text box will be updated automatically.


How to check spelling "as you type"

You may want to give your users immediate feedback on spelling errors, to report misspellings as they occur in real time. This feature is used in Microsoft Office. Your users are probably already familiar with the "as you type" spellchecking feature and may demand it in your product. Including it will give your product a competitive advantage.

"As you type" spell checking in rich-text boxes and TX Text Control is easy with Sentry! Just catch the Change and SelChange events, and call the Sentry's CheckCtrlBackgroundNotify function. Sentry will monitor the user's typing in the control in the background, marking misspelled words (e.g., by changing them to red, or in the case of TX Text Control, using a red zigzag underline) as they are typed. Corrected words are unmarked automatically. You can call the CheckCtrlBackgroundMenu function to display a spelling context menu in response to a right-mouse click.

"As you type" spell checking. The context menu shows suggested replacements for misspelled words.


How to spell check strings

The text you want to spell check may not be entered by the user -- it may be read from a disk file or database, or obtained from data structures within your Visual Basic application.

Sentry Spell Checker can check words contained in strings interactively or non-interactively.

Spell check dialog showing context display.

To check a string interactively, just pass it to Sentry's CheckBlockDlg function. The string can contain a single word or an entire book. Sentry will check the spelling of words in the string. If a misspelled word is found, Sentry will pop up a dialog the user can interact with to dispose of the problem. The dialog shows suggested replacements for the misspelled word. If the user makes a correction, the string will be updated automatically. CheckBlockDlg can even optionally show the string's contents in a text box attached to the dialog so the user can see the misspelled words in context.

Checking strings non-interactively is done via the CheckString function. CheckString is usually called in a loop. It checks each word in the string and returns when it finds a misspelled word or when all words have been checked. Your application can obtain a list of suggested replacements for the misspelled word from the Suggest function.


Home Site index Contact us Catalog Shopping Cart Products Support Search


Copyright © 2015 Wintertree Software Inc.