Add spell-checking functionality inside Microsoft Visual Studio

Applies To:

All .NET Products


Raleigh Johnson

Published On:


As most developers know, spelling errors within an application can be very problematic and, sometimes, even embarrassing. To solve this problem in the past, many developers were forced to perform this task manually or to export and import files into Microsoft Word or a similar application, both of which were very inconvenient.

Those days are over, thanks to IntelliSpell from ComponentOne, allowing .NET developers to focus more attention on the functionality and performance of their project, rather than the spelling errors within it. ComponentOne IntelliSpell works much like the all-so-familiar Spell-check feature of Microsoft Word, but brings this functionality to Visual Studio 2005, 2008, and soon 2010.

While some spell-check add-ins require Microsoft Office to be installed, IntelliSpell operates on its own spell-checking engine and does not require the spelling services of Microsoft Office to spell-check the XML files, comments, and code in your project. However, IntelliSpell does not stop here, as it includes many additional features and options that will prove to be very helpful throughout the development lifecycle of your application.

Before you begin, download IntelliSpell.

[Download IntelliSpell](

Once you have installed ComponentOne IntelliSpell, you may begin to spell-check your projects in Visual Studio using one of the following three methods:

  • From the Visual Studio menu: Select Tools | ComponentOne IntelliSpell
  • From the ComponentOne IntelliSpell Visual Studio toolbar: Right-click an empty part of the Visual Studio toolbar area and make sure the ComponentOne IntelliSpell toolbar is checked. Then select a command from the toolbar to begin spell checking.
  • From the Visual Studio Task List: Select View | Task List and make sure the ComponentOne IntelliSpell item is selected on the list.

Each of these three methods offers the same six commands: Check Active Document, Check Current Project, Check Entire Solution, Check Selected Documents, Options, and About ComponentOne IntelliSpell.

The ComponentOne IntelliSpell toolbar offers two additional commands, Stop Spell-Checking and Show C1IntelliSpell Window.

Before we start to spell-check our Visual Studio project, let's take a look at the ComponentOne IntelliSpell Options dialog box.

In the ComponentOne IntelliSpell Options dialog box, you can configure IntelliSpell to meet the specific needs of your project, whether it is a Web page or a Windows Forms application. The Options dialog box is divided into two tabs, Common and File to Check.

Common Tab

The first tab, Common, is broken down into three sections:

  • Spell Dictionaries
  • Spelling Options
  • Spell-check After Build

In the Spell Dictionaries section, you have the option to choose from over 15 dictionary files including French, Spanish, Russian, and English-Medical; but by default, IntelliSpell uses the American English dictionary as its Main Dictionary file. The Main Dictionary file can easily be changed by opening the drop-down box and selecting a new dictionary from the list. In addition to the Main Dictionary, you may also create your own dictionary file to store custom and application-specific words that should be ignored by IntelliSpell. You can add custom words to the user dictionary by right-clicking on a misspelled word and selecting "Add to Dictionary". One can also add words to the user dictionary by manually adding words, one per line, to the newly created text file. If you wish to use a custom dictionary, you must first assign it the User Dictionary option in the Options dialog box.

In the Spelling Options section, you have the option to select which types of words to ignore when spell-checking, for instance words containing numbers can be checked or ignored. You may also choose how to treat other types of words in Spelling Options section, for example, words containing underscores can be checked as a single word or split into multiple words. This section also allows you to choose the number of spelling suggestions that IntelliSpell provides, and whether or not IntelliSpell should implement As-You-Type Spell Checking. Another option in this section is the Ignore wildcards option which allows you to add special character phrases, denoted by an asterisk, to be ignored by IntelliSpell.

Lastly on the Common tab, the Spell-Check After Build section gives you the option to automatically spell check each time you build the project, each time you build a project with the word "Release" in its name, or never automatically spell-check the Visual Studio project.

Files to Check Tab

The second tab, Files to Check, allows you to specify which files to spell-check and how to treat these files.

By default, IntelliSpell has this section pre-populated with common file types to spell-check like C# code files (.cs) or a XML files (.xml); however, file types can easily be added or removed by expanding the file type node, clicking the ellipsis button next to "File extensions to check", and adding a file extension to the list. In this section, you can also entirely disable some file types from being checked, like XML files, by expanding the "XML files" node and changing the Enabled property to False. Please note that any file type not included in the Files to Check section will not be scanned for spelling errors. Now that we have taken at look at its options, let's take a look at IntelliSpell in action!

Let's start by opening a sample application that comes with the ComponentOne Studio for Silverlight: MasterDetail. This sample (located in the C:\Program Files\ComponentOne\Studio for Silverlight\Samples directory by default) demonstrates how to use our DataGrid control to create a data-centric rich internet application.

Once the sample application has opened, please ensure that the Common tab of the IntelliSpell Options dialog box looks similar to the following screenshot and then select OK:

Don't worry about the Files to Check tab at this point, as we will touch base on this in just a moment. Now open the Page.xaml.cs file; you should see several words currently underlined as such:

This word, marked by a wavy underline, is an example of the Check spelling as you type option. To correct this error or any other misspelled word, you can right-click on the spelling error and select one of the listed options from the context menu. For this example, I selected address from the context menu.

Now let's check the entire Page.xaml.cs file for errors by selecting the Spell-Check Active Document button from the ComponentOne IntelliSpell Toolbar. Now, your Task List should look similar to the following:

You can easily correct both of these spelling errors by double-clicking on the misspelled word in the Task List, right-click on the spelling error in the Page.xaml.cs file, and selecting the proper word from the context menu just as you did before. Alternatively, you can simply right-click on the word in the Task List and select the correct spelling from the context menu. Also, notice that Silverlight is marked as a spelling error when it is actually spelled correctly. You can add this word to your custom dictionary by right-clicking on the word in the Task List and selecting the Add to Dictionary option from the context menu. Once you have added the word to the user dictionary file, notice that Silverlight is no longer marked as a spelling error. Furthermore, when you open your custom dictionary file and look at its contents, it should contain the word Silverlight as you see below.

The Spell-Check Active Project and Spell-Check Current Solution spell-checking options work very similar to the Spell-Check Active Document option.

With IntelliSpell, you can easily turn spell checking on and off for certain blocks of code. For example, if you have a rather large portion of code commented out or just a large comment block that you would rather not check for spelling inaccuracies, you can place that portion of text, code, or etc., between the commented strings #c1spell(off) and #c1spell(on) as seen below.

Notice that the words large and check are misspelled, but they are not marked as such because these words are in between the string comments // #c1spell(off) and // #c1spell(on). Another example of this IntelliSpell feature can be seen below (this time in XAML rather than in C# code).

Next, let's examine how to use the Ignore Wildcards option. Open the IntelliSpell Options dialog box, ensure the Ignore Wildcards option is checked, and then click the Edit Wildcards. button. This will open the Ignore Wildcards Editor as shown below.

In the Ignore Wildcards Editor, you can add a character string on a line by line basis to be ignored by IntelliSpell. These character strings must be denoted by an asterisk (). For this example, we will add th and *th to the Ignore Wildcards Editor and click the OK button. Now, as you can see below, any misspelled words beginning or ending with a lowercase th will be ignored by IntelliSpell. Please note that the Ignore Wildcards Editor is case-sensitive.

Now let's take a look at checking an XML file for spelling errors. First, start by closing the MasterDetail example and opening an ASP.NET or WinForms application. Once the ASP.NET or WinForms application has loaded, open the Visual Studio Solution Explorer and click the Show All Files button. From within the Solution Explorer, expand the Properties node and select the licenses.licx file, right-click on the licenses.licx file, and select Spell-Check Selected Documents from the context menu. This option will check only the licenses.licx file; however, the message below appears.

This is because the .licx file extension is not included in the Files to Check tab. Let's add the .licx file extension to the XML file types to check (.licx files is a type of XML file). Open the IntelliSense Options dialog box, select the Files to Check tab, expand the XML files node, and click the ellipsis button next to the Files extensions to check option. This will open the File extensions editor. Now add .licx to the XML file extensions list as seen below.

Now let's right-click on the licenses.licx file once again and select the Spell-Check Selected Documents from the context menu. You should no longer see any message box appear, and you should not have any spelling errors.

In this article we have shown the benefits that IntelliSpell has to offer by reducing the number of spelling errors in a .NET application or eliminating them entirely. Take full advantage of IntelliSpell today by downloading the 30-day trial.

[Download IntelliSpell](


GrapeCity Developer Tools
comments powered by Disqus