Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I add spell-checking to my rich text box?
    primarykey
    data
    text
    <p>I would like to know if there's an easy way to implement spell check to my rich text box? I have heard there's a way to use the spell check from MS Word, but I would like to know if I could add an independent spell check to my application. If somebody could provide me with a tutorial on how to do this (video or webpage or example or anything), then I'd really appreciate it.</p> <p>--EDIT--</p> <p>Following on from the answer I received, I implemented the spell check to my code and it is now as follows:</p> <pre><code>private NetSpell.SpellChecker.Spelling spelling; private NetSpell.SpellChecker.Dictionary.WordDictionary wordDictionary; internal System.Windows.Forms.Button spellButton; internal System.Windows.Forms.RichTextBox demoRichText; private System.ComponentModel.IContainer components2; internal System.Windows.Forms.RichTextBox Document; internal NetSpell.SpellChecker.Spelling SpellChecker; private System.ComponentModel.IContainer components1; internal NetSpell.SpellChecker.Dictionary.WordDictionary WordDictionary; </code></pre> <p>...</p> <pre><code>private void toolStripButton1_Click(object sender, EventArgs e) { try { this.spelling.Text = this.richTextBoxPrintCtrl1.Text; // I get an error on this line. this.spelling.SpellCheck(); } catch { MessageBox.Show("Error loading Spell Checker. Please reload application and try again.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void spelling_DeletedWord(object sender, NetSpell.SpellChecker.SpellingEventArgs e) { int start = this.richTextBoxPrintCtrl1.SelectionStart; int length = this.richTextBoxPrintCtrl1.SelectionLength; this.richTextBoxPrintCtrl1.Select(e.TextIndex, e.Word.Length); this.richTextBoxPrintCtrl1.SelectedText = ""; if (start &gt; this.richTextBoxPrintCtrl1.Text.Length) start = this.richTextBoxPrintCtrl1.Text.Length; if ((start + length) &gt; this.richTextBoxPrintCtrl1.Text.Length) length = 0; this.richTextBoxPrintCtrl1.Select(start, length); } private void spelling_ReplacedWord(object sender, NetSpell.SpellChecker.ReplaceWordEventArgs e) { int start = this.richTextBoxPrintCtrl1.SelectionStart; int length = this.richTextBoxPrintCtrl1.SelectionLength; this.richTextBoxPrintCtrl1.Select(e.TextIndex, e.Word.Length); this.richTextBoxPrintCtrl1.SelectedText = e.ReplacementWord; if (start &gt; this.richTextBoxPrintCtrl1.Text.Length) start = this.richTextBoxPrintCtrl1.Text.Length; if ((start + length) &gt; this.richTextBoxPrintCtrl1.Text.Length) length = 0; this.richTextBoxPrintCtrl1.Select(start, length); } private void spelling_EndOfText(object sender, System.EventArgs e) { Console.WriteLine("EndOfText"); } </code></pre> <p>However, when I try to load the checker, I get a NullReferenceExeption was unhandled error on the line uncommented in the code.</p> <p>Any ideas? I don't know where to go from this point. I can load the program, but I get an error on the uncommented line of code. I've tried following the demo, but I can't seem to see why the demos code works but mine refuses to play nice... My code is exactly the same as the demo example (from what I can see), so why is it now working and giving me an error when I try to run the spell checker?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload