Setting Thesaurus for .NET to Check a Selected Word
To check a word selected in the textbox, complete the following steps:
1. Set the CheckWord method to the selected string. Enter the following code in the Button_Click event handler:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.SelectedText = Me.C1Thesaurus1.CheckWord(TextBox1.SelectedText)
End Sub
• C#
private void button1_Click( object sender, EventArgs e)
{
textBox1.SelectedText = this.c1Thesaurus1.CheckWord(textBox1.SelectedText);
}
Note: Once you set the CheckWord method 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 method will not run until the Complete event is fired.
2. Run the C1Thesaurus program.
3. In the textbox, type a word and highlight it.
4. Then click the Thesaurus button to look for other similar words.
|