TX Spell .NET for Windows Forms TX Spell .NET for WPF Both versions of TX Spell .NET (Windows Forms and WPF) ship with a non-visual component: TXTextControl.Proofing.TXSpell. This class can be used for ASP.NET Web Services, Web Applications or even Windows Services.

In order to create an instance of this pure spell checking engine, the following code is required:

TXTextControl.Proofing.TXSpell txSpell1 = new TXTextControl.Proofing.TXSpell();
txSpell1.Create();

The Create method initializes the resources of a newly instantiated TXSpell object.

After an instance has been created, the Check method can be called to check the spelling of single words, a paragraph or a whole text. In this sample application, the content of an ASP.NET TextBox should be validated using the ServerValidate event of a CustomValidator. Using this validator object is a very smart way to validate user input and to display custom error messages when the input could not be validated. The following code is used to validate the content using TX Spell .NET:

protected void CustomValidator1_ServerValidate
            (object source, ServerValidateEventArgs args)
{
    TXTextControl.Proofing.TXSpell txSpell1 =
        new TXTextControl.Proofing.TXSpell();

    txSpell1.Create();

    txSpell1.Check(args.Value);

    if (txSpell1.IncorrectWords.Count == 0)
        args.IsValid = true;
    else
    {
        args.IsValid = false;

        string sErrorMessage = "Misspelled.";

        txSpell1.CreateSuggestions(args.Value);

        if (txSpell1.Suggestions.Count > 0)
            sErrorMessage +=  " Do you mean '" +
                txSpell1.Suggestions[0].Text + "'?";

        CustomValidator1.ErrorMessage = sErrorMessage;
    }
}

In a first step, the input string is checked for spelling errors. If the word is misspelled, TX Spell .NET is used to create proper suggestions that are suggested to the user in the custom validation error message.

TX Spell .NET in an ASP.NET Web Application

This is just one way of using TX Spell .NET in a Web Application. How would you make use of it? Request a sample.

GitHub

Download and Fork This Sample on GitHub

We proudly host our sample code on github.com/TextControl.

Please fork and contribute.

Requirements for This Sample

  • Visual Studio 2017 or better
  • TX Text Control .NET Server for ASP.NET (trial sufficient)