locked
Add A SPELL CHECKER IN WINFORMS TEXTBOX RRS feed

  • Question

  • Hi,

    i need to add a spell cheker in my textbox of winforms  exacrly similar like i am writting here and wavy red lines appears at bottom for incorrect spell.

    Please Suggest any dll or any  other method to do this.

    Thanks


    rishi


    • Edited by Rishi90 Saturday, June 29, 2013 2:14 PM
    Saturday, June 29, 2013 2:13 PM

Answers

  • Hi Rishi90,

    I'm afraid there is no properties to add a spell checker into WinForms TextBox. I think what you can try is to host a WPF TextBox into WinForms application.

    http://msdn.microsoft.com/en-us/library/ms742215.aspx

    The easiest way is to drag an ElementHost from the WPF Interoperability tab in the Toolbox. Create a WPF TextBox, set SpellCheck.IsEnabled property to true. And then set ElementHost.Child property.

    System.Windows.Controls.TextBox tb = new System.Windows.Controls.TextBox();
    tb.SpellCheck.IsEnabled = true;
    this.elementHost1.Child = tb;
    Best regards,

    Chester Hong
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

    • Marked as answer by Chester Hong Monday, July 8, 2013 5:30 PM
    Sunday, June 30, 2013 4:47 AM

All replies

  • Hi Rishi90,

    I'm afraid there is no properties to add a spell checker into WinForms TextBox. I think what you can try is to host a WPF TextBox into WinForms application.

    http://msdn.microsoft.com/en-us/library/ms742215.aspx

    The easiest way is to drag an ElementHost from the WPF Interoperability tab in the Toolbox. Create a WPF TextBox, set SpellCheck.IsEnabled property to true. And then set ElementHost.Child property.

    System.Windows.Controls.TextBox tb = new System.Windows.Controls.TextBox();
    tb.SpellCheck.IsEnabled = true;
    this.elementHost1.Child = tb;
    Best regards,

    Chester Hong
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

    • Marked as answer by Chester Hong Monday, July 8, 2013 5:30 PM
    Sunday, June 30, 2013 4:47 AM
  • Chaster, that was a great example. It worked great on my application. 

    I have an additional question.

    How can you enable the horizontal scroll bars and text wrapping using your example above?

    Wednesday, December 4, 2013 10:39 PM
  • Hi Rishi90,

    I'm afraid there is no properties to add a spell checker into WinForms TextBox. I think what you can try is to host a WPF TextBox into WinForms application.

    http://msdn.microsoft.com/en-us/library/ms742215.aspx

    The easiest way is to drag an ElementHost from the WPF Interoperability tab in the Toolbox. Create a WPF TextBox, set SpellCheck.IsEnabled property to true. And then set ElementHost.Child property.

    System.Windows.Controls.TextBox tb = new System.Windows.Controls.TextBox();
    tb.SpellCheck.IsEnabled = true;
    this.elementHost1.Child = tb;
    Best regards,

    Chester Hong
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

    Chaster, that was a great example. It worked great on my application. 

    I have an additional question.

    How can you enable the horizontal scroll bars and text wrapping using your example above?


    Thursday, December 5, 2013 11:15 PM
  • Hi,  After adding the elementhost and child as above I cant get the leave event to fire in order to save the data.  The Enter event fires ok.

    this.elementHost1.Enter += new System.EventHandler(this.mytextbox_Enter);
    this.elementHost1.Leave += new System.EventHandler(this.mytextbox_Leave);

    Any ideas of an alternative.

    Thanks


    • Edited by nbryson Tuesday, February 18, 2020 3:25 PM
    Tuesday, February 18, 2020 3:17 PM