C1.Win.SpellChecker

Posted by: storerware72 on 5 September 2025, 1:47 pm EST

  • Posted 5 September 2025, 1:47 pm EST

    This is not an “end of the world” issue but have some user complaints/thoughts. Probably missed the solution in the documentation so feel free to refresh my memory/opine!

    Issue…

    Have multiple (up to 10 in some cases) text boxes on various forms in the application. During the data save method, each textbox is first spellchecked individually using the “CheckControl” with the user being alerted/given options as advertised. Everything works perfect!

    sample snippet…

    private C1SpellChecker SpellCheck = new C1SpellChecker();

    SpellCheck.CheckControl(textbox1, true);

    SpellCheck.CheckControl(textbox2, true);

    SpellCheck.CheckControl(textbox3, true);

    However, users want the option to click “CANCEL” SpellChecker dialog box to abandon the entire sequence of spellchecking for the remainder of the text boxes.

    Example: when Textbox1 is spellchecked the user may want to click cancel and skip textbox2 and textbox3.

    **

    Is there a way to capture the Cancel button click event from the SpellCheck dialog? **

    Just making this up but say,

    SpellCheck.CheckControl(textbox1, true);

    if (SpellCheck Dialog Cancel Button Is Clicked==True)

    {

    SaveTheData;

    }

    else

    {

    SpellCheck.CheckControl(textbox2, true);

    SpellCheck.CheckControl(textbox3, true);





    }

    Open to thought, user anecdotes, snide remarks, and so on.

    Thanks in advance

  • Posted 8 September 2025, 3:46 am EST

    Hello,

    Yep — you don’t need a special “Cancel clicked” event. C1SpellChecker.CheckControl(…) returns an int: the number of errors found, or -1 if the user cancels the dialog. So you can just check the return value after each textbox and bail out of the sequence.

    Here’s a simple pattern:

    // assume SpellCheck is your C1SpellChecker
    var boxes = new TextBoxBase[] { textBox1, textBox2, textBox3 };
    
    bool canceled = false;
    
    foreach (var tb in boxes)
    {
        int result = SpellCheck.CheckControl(tb, true); // modal dialog
        if (result == -1)  // user hit Cancel
        {
            canceled = true;
            break;          // skip the rest
        }
    }
    
    // Either way, continue your save (or change this branch if you want to abort saving on cancel)
    SaveTheData();

    If users clicks “Cancel” on the first box, it’ll skip the rest and move straight to save (or whatever you prefer in that branch).

    Please refer to the attached sample for implementation. (see SpellChecker_CancelChecking.zip)

    Regards,

    Uttkarsh.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels