Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to activate spellCheck in C# Windows Form Application?

I am making a C# Windows Form Application in Visual Studio 2012. I want add a textbox with spell checking capabilities. Could you please explain me the process for it ?

like image 238
user3218743 Avatar asked May 23 '14 16:05

user3218743


2 Answers

I know old link but Buzzzzz is correct. WinForms can't do it but it is really easy to create a wpf textbox or richtext box control and add it to your WinForms. Finding that darn property to tell the textbox to spell check is tricking but seriously,

  1. open or create a new winforms project,
  2. then menu project add new item,
  3. click wpf on the left and select select wpf control on the right **glitter, screen magic and you are looking at the weird layout if you are not familiar with WPF,
  4. select tools,
  5. select wpf textbox , drag and drop, BAM, sizing is a bit trial and error if you are new.
  6. Add references too WindowsBase, WindowsFormIntegration, UIAutomationProvider.
  7. Add PresentationCore and PresentationFramework if not already added, should have came in with the add new. Oh maybe System.Xaml but I think it is automatic too.
  8. Save it and rebuild.

You now have a control in your toolbox named whatever you names it. Drag and drop the control from the toolbox and there you go. To talk to it the defaults would be userControl1.TextBox.Text

Oh almost forgot. The Winforms and WPF are not all that friendly with each other and you will have to compile to remove the red line squiggles if they appear.

like image 100
The Old I.T. Guy Avatar answered Oct 06 '22 00:10

The Old I.T. Guy


There is no built-in spellcheck capability on the Windows Forms textbox.

The best thing you can do is probably embed an WPF textbox in your form. Hans Passant gives a very thorough answer in this post on how to achieve that.

like image 42
julealgon Avatar answered Oct 06 '22 00:10

julealgon