One of my customers wanted to add spell check functionality to their windows Form application. knowing that everyone in their organization has Microsoft Office installed, I did not want to include word interop with the application. so I found a neat way of using words spellcheck. for more information you might want to check this article that was very helpful .
Private Sub SpellAndGrammarCheck(ByVal YourTextbox As TextBox)
Try
Dim oWord As Object = Nothing
Dim oDoc As Object = Nothing
Dim oData As IDataObject = Nothing
oWord = System.Activator.CreateInstance(Type.GetTypeFromProgID("Word.Application"))
Dim oDocuments as object = oWord.[GetType]().InvokeMember("Documents", _
BindingFlags.[Default] Or BindingFlags.GetProperty, _
Nothing, oWord, Nothing)
oDoc = oDocuments.[GetType]().InvokeMember("Add", BindingFlags.[Default] _
Or BindingFlags.InvokeMethod, Nothing, oDocuments, Nothing)
oWord.Visible = False
oWord.WindowState = 0
oWord.Top = -3000
Clipboard.SetDataObject(YourTextbox.Text)
With oDoc
.Content.Paste()
.Activate()
.CheckGrammar()
.Content.Copy()
oData = Clipboard.GetDataObject
If oData.GetDataPresent(DataFormats.Text) Then
YourTextbox.Text = CType(oData.GetData(DataFormats.Text), String)
End If
.Saved = True
.Close()
End With
oWord.Quit()
MsgBox("Spelling check complete!")
'SPELLWORKING = True
Catch COMEcep As COMException
MsgBox("MS Word must be installed to perform spelling checks", , _
"Spell check is not available")
Catch ex As Exception
MsgBox("Error, Make sure you have MS word installed.", , ex.Message)
End Try
End Sub