ComponentOne Spell 8.0 for ActiveX
Setting VSThesaurus to Check a Selected Word

To check a word selected in the textbox, set the CheckWord property to the selected string. The following code does this:

Example Title
Copy Code
  Private Sub Command1_Click()

 

    ' Make sure a word is selected.

    If Text1.SelLength = 0 Then Exit Sub

 

    ' Trim any blank spaces from right end of the word.

    Do While Text1.SelLength > 0

      If InStr(" ,.:;", Right(Text1.SelText, 1)) = 0 Then Exit Do

      Text1.SelLength = Text1.SelLength - 1

    Loop

 

    ' Look it up (this may cause the Synonym dialog box to appear).

    VSThesaurus1.CheckWord = Text1.SelText

 

    ' Replace the word with the user selection, if any.

    If Len(VSThesaurus1.ChangedWord) > 0 Then

      Text1.SelText = VSThesaurus1.ChangedWord

    End If

  End Sub
Note: Once you set the CheckWord property from code, execution of your code is suspended until the Complete event is fired. In other words, any code following the statement that sets the CheckWord property will not run until the Complete event is fired.

Run the VSThesaurus program. Type a word into the textbox. Highlight the word in the text box, and then click the Thesaurus button to look for other similar words.

 

 


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

Product Support Forum  |  Documentation Feedback