ComponentOne SpellChecker for WinForms
C1.Win.C1SpellChecker.4.8 Assembly / C1.Win.C1SpellChecker Namespace / C1SpellChecker Class / AutoReplaceList Property
Example

In This Topic
    AutoReplaceList Property (C1SpellChecker)
    In This Topic
    Gets a list of words and replacements to use while spell-checking.
    Syntax
    'Declaration
     
    Public ReadOnly Property AutoReplaceList As WordDictionary
    public WordDictionary AutoReplaceList {get;}
    Remarks

    This list is used by the built-in spell dialog and by the as-you-type mechanism.

    The built-in spell dialog checks the list when it finds a misspelled word. If a match is found, the misspelled word is replaced with the corresponding list entry.

    The as-you-type mechanism looks for matches whenever the user types a character that is not a letter or a digit. If a match is found, the text is replaced with the corresponding list entry.

    Note the difference in operation between the two modes. In as-you-type spell-checking, any matches will be replaced, whether the key is spelled correctly or not. In dialog mode, keys that are spelled correctly will not be flagged as errors and therefore will not be replaced. For example, if the AutoReplaceList contains an entry with the strings ("attn.", "attention of"), then typing "attn. " into the editor will trigger a replacement and the editor will contain "attention of ". However, because "attn." is not a spelling error, the spell dialog will not replace instances of the string "attn." with "attention of".

    The C1SpellChecker raises the AutoReplace event before making each automatic replacement. The event handler may cancel the replacement.

    Strings in the list are case-sensitive.

    Example
    The example below causes the C1SpellChecker to monitor spelling on a System.Windows.Forms.TextBox control. If the user types the string "teh", it is automatically replaced with "the". If the user types "cant", it is automatically replaced with "can't".
    // build AutoReplace list
    c1SpellChecker1.AutoReplaceList.Clear();
    c1SpellChecker1.AutoReplaceList.Add("teh", "the");
    c1SpellChecker1.AutoReplaceList.Add("cant", "can't");
                
    // activate as-you-type spell-checking on textBox1
    c1SpellChecker1.SetSpellChecking(textBox1, true);
    See Also