Introduction

I wanted a spell check that I could use in .NET, so like most people would have done, I Googled. After many hours of fruitless searching, I decided to make my own; sure there are plenty of spell checkers out there, but I didn't want one that relied on 3rd party components such as Word or require Internet connectivity to work. Introducing i00 .NET Spell Check, the first and only VB.NET Spell Check written completely in VB! Not only that, it is also open source, and easy to use.

aboutspell.png

Screen Shots

Spell check with definitions

In-menu word definitions and Change to...

Adding words to dictionary

Custom content menus

Crossword generator

Options

Owner draw and RTB support

Using the Code

To implement i00 .NET Spell Check into your project, first either:

  • Reference the i00SpellCheck.exe file that is output from this project
  • Add the i00SpellCheck project to your solution and reference it
  • or you can bring all of *.vb files in the "SpellCheck\Spell Check" folder (from the zip) directly into your own project

Next, simply place this at the very top of your form:

* the code below may change if you used option 3 to "Imports YourProject.i00SpellCheck"):

Imports SpellCheck.i00SpellCheck

Now you will be able to enable spell check. The above line will enable spell checking on all multiline textboxes on your form, and all owned forms that are opened.

Some other examples are below:

''enable the spell check
''this will enable the spell check on ALL TEXT FIELDS ON THIS form 
''AND ALL TEXT FIELDS ON ALL OWNED FORMS AS THEY OPEN automatically :)
''... but only for multi line Rich/Text Boxes
Me.EnableSpellCheck()
''To enable spell check on single line textboxes you will need to call:
''TextBox.SpellCheck()

''if you wanted to pass in options you can do so by going:
Dim SpellCheckSettings As New i00SpellCheck.SpellCheckSettings
SpellCheckSettings.DoSubforms = true 'Specifies if owned forms 
			'should be automatically spell checked
SpellCheckSettings.AllowAdd = true 'Specifies if you want to 
			'allow the user to add words to the dictionary
SpellCheckSettings.AllowIgnore = true 'Specifies if you want 
			'to allow the user ignore words
SpellCheckSettings.AllowRemove = true 'Specifies if you want 
			'to allow users to delete words from the dictionary
SpellCheckSettings.AllowInMenuDefs = true 'Specifies if the 
		'in menu definitions should be shown for correctly spelled words
SpellCheckSettings.AllowChangeTo = true 'Specifies if "Change to..." 
	'(to change to a synonym) should be shown in the menu for correctly spelled words
Me.EnableSpellCheck(SpellCheckSettings)

''You can also enable spell checking on one text field:
TextBox1.SpellCheck()
''Note that the above is NOT threaded - so if you fire it from the 
''interface it can "freeze" for a second if the dictionary is not yet loaded 
''(unless you load the dictionary in a separate thread).

''To change options on an individual text box:
TextBox1.SpellCheck.AllowAdditions = True
TextBox1.SpellCheck.AllowIgnore = True
TextBox1.SpellCheck.AllowRemovals = True
TextBox1.SpellCheck.ShowMistakes = True

''To load a custom dictionary from a saved file:
Dim Dictionary = New i00SpellCheck.SpellCheckTextBox.Dictionary("c:\Custom.dic")

''To create a new blank dictionary and save it as a file
Dim Dictionary = New i00SpellCheck.SpellCheckTextBox.Dictionary("c:\Custom.dic", True)
Dictionary.Add("CustomWord1")
Dictionary.Add("CustomWord2")
Dictionary.Add("CustomWord3")
Dictionary.Save()

''To Load a custom dictionary for an individual text box:
TextBox1.SpellCheck.CurrentDictionary = Dictionary 

Even more examples are included in the Test project in the download.

Points of Interest

The words that get checked are added to a dictionary cache to speed up checking - the smaller cache is checked first. If the word is not found in the cache, then it checks the main dictionary.

I use fields (public variables) instead of properties for some basic classes, as they are about 2x faster than properties.

Thanks

Thanks for downloading.

Suggestions on possible improvements are much appreciated.

推荐.NET配套的通用数据层ORM框架:CYQ.Data 通用数据层框架
新浪微博粉丝精灵,刷粉丝、刷评论、刷转发、企业商家微博营销必备工具"