views:

266

answers:

2

How can I add a spellchecker to a richtextbox in my application?

+1  A: 

You can purchase a spell checker control, integrate the Microsoft Office Spell Checker, write your own (which isn't too hard, actually, once you get the Soundex function figured out), or get a good free one. Here's a (relatively) good free one.

http://www.codeproject.com/KB/recipes/spellchecker_mg.aspx

For commercial products, I'd say to Google "Spell check WinForms"

If you're interested in rolling your own, I wrote one for Asp.Net back when I was in my beginner phase, and even then it only took me about a week to research and then a day or so to code. It's a fun pet project. I'd start by looking at soundex functions and comparing soundex values for similarity.

You start by comparing all of the words in the TextBox to a known dictionary, and using the soundex functions to come up with similar words.

From there, you can go on to creating a table for "popular replacements. (for example, you can track that the word "teh" was replaced by "the" n times and move the more popular replacements to the top of the list.

David Stratton
You forgot to spell-check.
Snarfblam
That's funny! But you're right. I just fixed it. Thank you.
David Stratton
Is there a way to hook into ASpell?
Malfist
I'm not sure. Google searches didn't turn up much, but this looks promising: http://www.informit.com/articles/article.aspx?p=354351
David Stratton
A: 

I found a better solution. Hunspell is the spellcheck library Mozilla and OpenOffice.org uses. Its been ported to .NET as NHunspell, and is real easy to implement and has samples for you to use.

Malfist