AutoCorrect: TWo INitial CApitals
TX Spell .NET enables AutoCorrect for words with two initial capitals by hooking into the Changed event of TX Text Control. The handler checks each misspelled word for leading uppercase pairs, validates the lowercase form against the dictionary, and replaces the word if valid.

In today's mobile world and because of the progress made in AutoCorrect technology in smartphones, users get confused, if their desktop application doesn't provide the same functionality.
Using TX Spell .NET, you integrate one of the most powerful spell checking and correction engines into your .NET based applications. Based on the analysis of thousands of documents, the expected suggestion is ranked at position 1 or 2 in more than 97% of all cases. The algorithm includes the measurement of the distance between the keys on the currently used keyboard. Many different factors are evaluated and rated to create the accurate list of suggestions.
A popular feature in MS Office is the AutoCorrect feature TWo INitial CApitals. If a word starts with two initial capitals, but the word itself is not misspelled, it will be corrected automatically.
Using TX Text Control and TX Spell .NET, this feature can be easily implemented.
On the Changed event of TextControl, all misspelled words are checked whether the first two letters are uppercase. If true and the lower case word is not misspelled, the word is corrected by replacing the upper case character with its lower case counterpart. The corrected word is then replaced in TextControl using the MisspelledWords.Remove method.
private void textControl1_Changed(object sender, EventArgs e)
{
if (correctTWoINitialCApitalsToolStripMenuItem.Checked == false)
return;
// loop through all misspelled words
foreach (MisspelledWord word in textControl1.MisspelledWords)
{
// if the first two initials are uppercase
if (char.IsUpper(word.Text[0]) && char.IsUpper(word.Text[1]))
{
// and the word is not mispelled
txSpellChecker1.Check(word.Text.ToLower());
// replace the word
if (txSpellChecker1.IncorrectWords.Count == 0)
textControl1.MisspelledWords.Remove(word,
ToUpperFirstLetter(word.Text));
}
}
}
// returns a string with the first letter uppercase
public static string ToUpperFirstLetter(string source)
{
if (string.IsNullOrEmpty(source))
return string.Empty;
char[] letters = source.ToLower().ToCharArray();
letters[0] = char.ToUpper(letters[0]);
return new string(letters);
}
You can download the Visual Studio 2012 project to do your own tests. At least, trials version of TX Spell .NET for Windows Forms and TX Text Control .NET for Windows Forms are required.
Happy coding!
Related Posts
Web.TextControl and Spell Checking
TX Spell .NET integrates spell checking into the HTML5-based Web.TextControl editor running on TX Text Control .NET Server. Once deployed alongside the web server service, it provides…
ProofingSpell CheckingTutorial
TX Spell .NET: Not Only a Spell Checker
TX Spell .NET integrates spell checking, hyphenation, and language detection into Windows Forms, WPF, and ASP.NET applications. It offers spell-as-you-type with red underlines, correction dialogs,…
TX Spell .NET: Ignore Word List Using User Dictionaries
TX Spell .NET supports multiple simultaneous dictionaries for spell checking, including both language and user dictionaries. By creating a secondary UserDictionary with IsEditable set to false,…
TX Spell .NET ActiveX Package Released - Spell Checking in VB6
The TX Spell .NET ActiveX Package wraps .NET-based spell checking functionality for Visual Basic 6 through a COM wrapper control. Setup requires installing the package, compiling the AxTXSpell…
Porting RapidSpell to TX Spell .NET
TX Spell .NET serves as a direct replacement for RapidSpell in existing projects. This migration guide covers differences in dictionary handling, dialog box integration, and spell-as-you-type…
