VB.NET - Error with Spell Checker (NHunspell)

517 views Asked by At

Basically I'm using NHunspell to check for spelling errors and I've come across an error and problem.

The Error is that whenever the NHunspell is added to a textbox or richtextbox, it simply cannot be docked to a container or resized while docked. It crashes. In order to avoid this error I have to simply lock the form and disable the maximize button. This way the user can just close and resize the program.

The error:

`System.ArgumentException: Parameter is not valid.
   at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
   at NHunspellExtender.NHunspellTextBoxExtender.CustomPaintTextBox.TextBoxBase_ClientSizeChanged(Object sender, EventArgs e)
   at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
   at System.Windows.Forms.Control.UpdateBounds()
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.RichTextBox.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)`

The other problem is that there seems to be performance issues. If i was to load a file with about 500+ characters and there are quite a bit of errors let's say 25, and I try to scroll down the page, it get's quite laggy.

I know this is a lot but I'm wondering if anyone who has been using this found a solution to it of if anyone can help me that would be great!

PS. The problem ONLY happens if i'm using RichTextBoxes. TextBoxes are fine.

1

There are 1 answers

0
Zer0 On

An easier workaround was to use the WPF RichTextBox. This came with a default Spell Check which Now I'm using in WinForms. I did this by Using the Host Element for WinForms. Although the TUTORIAL uses a DataGrid it's easy to change it to whatever control you want.

However I would still like to know a solution.