ComponentOne Spell 8.0 for ActiveX
Step 4: Provide Long Document Spell Checking (Middle Panel)

This step is really simple. Double-click the button on the middle panel and add the following code to the Command1_Click event:

Example Title
Copy Code
Private Sub Command1_Click()

 

    ' This will check the whole window, displaying the bad-word dialog whenever a bad word is found and correcting words as needed.

    VSSpell2.CheckWindow Text2.hWnd

   

    ' When done, give the user some feedback.

    If VSSpell2.BadWordCount > 0 Then

        MsgBox "Done spell checking. " & VSSpell2.BadWordCount & " typing errors handled."

    End If

End Sub

All it takes to spell check the window is a single call to the CheckWindow method. We also show a message box after we're done spell checking, but this is optional.

If you think you will be spell checking really long documents (over 200K, say), you may also want to handle the VSSpell2_Checking event. This will fire every second while spell checking a long document so you can display a progress bar or cancel the spell-checking process.

That's it for the middle pane on our demo. Save the project and run it again. Type some text into the middle panel textbox and click the button below. If you make any mistakes, you will see a dialog box containing suggestions, as shown below:

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback