Using Words Spellcheck and grammer check with your windows Forms application

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

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Print | posted on Wednesday, November 05, 2008 3:42 PM

Comments on this post

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
I would like to have spellcheck and grammer ckeck
Left by alberta on Jan 20, 2009 8:29 PM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
Thanks for this share it helped me greatly!
Left by Speech Service on Nov 23, 2009 7:27 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
very informative article. Thanks a lot for sharing.
Left by Sally blog on Jan 11, 2010 2:35 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
i have red your article it was pretty good post..you made some good points
Left by megamillions on Jan 21, 2010 8:10 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
Very nice post. Information given is nicely elaborated. Thanks for sharing.
Left by last longer in bed on Jan 22, 2010 4:29 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
It is a great application and saves the user from a lot of overhead.
Left by Criminal Background Check on Jan 27, 2010 12:25 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
spell check is so useful for our article review....thanks for sharing the views...
Left by oak dining furniture on Jan 27, 2010 5:45 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
This is the first time, i read your bloge, its content is very useful.
Left by Ngan hang on Feb 08, 2010 4:46 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
Really awesome article with plenty of informative things to be known for us .Keep posting more articles like this.
Left by Advanced link building strategie on Feb 10, 2010 5:29 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
wow. what kind of programming language is this?
Left by Health Alert on Feb 11, 2010 9:06 PM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
thanks for your nice experience to share with us .Really awesome article with plenty of informative things to be known for us
Left by Dirt bike games on Feb 15, 2010 11:22 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
very nice post ...the information provided is so useful to me this is what i was looking for.Thanks
Left by Drafon games on Feb 16, 2010 12:10 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
Very useful post - we used word spellcheck in our latest software release for our hiking boot stores CMS
Left by Best Hiking Boot's on Feb 17, 2010 9:43 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
The information provided is so useful to me, I'm glad I found this article.
Left by Car racing games on Feb 21, 2010 1:14 PM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
This is pretty impressive, if properly used it can reap huge benefits. :)
Left by Online Department Store on Feb 24, 2010 7:51 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
This looks like it is very useful indeed, do post here more often please as I find this information very useful
Left by 08 Numbers on Mar 17, 2010 8:45 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
Great Article Thank you
Left by 品川デリヘル on Jun 08, 2010 3:56 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
Very informative and helpful post. have explained in a very nice way, I was searching for this information and didn't find any thing better than this one. Thanks for sharing.
Left by Attache on Jun 19, 2010 4:51 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
Thanks for providing me with such a great resource and opportunities to comment and get excuted with your blog.
Left by Vital pharmacy on Jul 07, 2010 12:22 PM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
I salute you having this kind of idea. Honestly, for me, it will be a big help because through it, having a conversation with others will enhance my ability. That's why, I am really happy, when I read it, and feel so much interested. 
Left by Website Design Services on Aug 30, 2010 12:04 PM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
You could at least have the decency to spin it first. Here, let me help you with that:-
Left by ugg boots uk on Sep 30, 2010 1:27 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
I have read and see above all post its really informative and also provide valuable information which help me and other people which see this web so thanks to share it
Left by link building services on Oct 20, 2010 5:16 AM

# Teaching Quran

Requesting Gravatar...
i have read and see above all information and also provide valuable data<a href= "http://www.teachingquran.com/cannot change in this information Microsoft
Left by michel123 on Oct 25, 2010 3:42 PM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
Hi, nice post. I've been wondering about this issue, so thanks for posting. I'll definitely return to your site.I like how
you sent your information with excellent detail. Keep up the great work here.
Left by education grants on Nov 02, 2010 12:42 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
The post is very nicely written and it contains many useful facts. I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement. Thanks for sharing with us.
Left by Degrees on Nov 15, 2010 10:22 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
You have got a really useful blog I have been here reading for about an hour. I am a newbie and your success is very much an inspiration for me.
Left by Radiology Technician Info on Nov 25, 2010 1:37 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
It's good to see this information in your post, i was looking the same but there was not any proper resource, thank now i have the link which i was looking for my research.
Left by persönliche assistenz on Jan 29, 2011 2:06 AM

# Cadurnica

Requesting Gravatar...
Of course you will not be able to if you were told to read medical images or sonographic data if you have not received any education about it. In fact, for the moment, a promising job in the health sector are people who have skills and knowledge to read the sonographic data or medical images.Cadurnica
Left by simran on Apr 09, 2011 12:11 PM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
That's very informative article. and very useful now u can check your spelling and grammar.

mahut
Left by jack bondok on May 08, 2011 3:05 PM

# Information on Ultrasound Technicians

Requesting Gravatar...
Ultrasound equipment is developing with each passing day, and because of it there is a great demand for experienced people who are needed for almost all the handling of equipment in a hospital. It is not exaggerating to say that they are right hand of the doctors.
Left by Information on Ultrasound Techni on May 09, 2011 12:16 PM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Left by jusmine on Jul 01, 2011 6:07 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
Dear my lovely children
風の音を聞いて
大きな森

Left by Jusmine on Jul 04, 2011 9:03 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Left by Jusmine on Jul 05, 2011 12:18 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Left by Jusmine on Jul 06, 2011 6:23 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Left by Jusmine on Jul 07, 2011 9:19 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Requesting Gravatar...
I was just seeking this info for a while. After 6 hours of continuous Googleing, at last I got it in your website. I wonder what is the lack of Google strategy that do not rank this type of informative web sites in top of the list. Generally the top websites are full of garbage.

Left by school management software on Aug 05, 2011 10:21 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Left by Loung on Nov 30, 2011 10:37 PM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Left by Loung on Dec 01, 2011 10:23 PM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Left by Loung on Dec 05, 2011 1:07 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Left by Loung on Dec 06, 2011 5:32 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Left by Loung on Dec 06, 2011 9:26 PM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Left by Loung on Dec 13, 2011 9:32 PM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Left by Loung on Jan 29, 2012 11:08 PM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Left by Loung on Jan 31, 2012 3:30 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Left by Loung on Feb 02, 2012 9:41 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Left by Loung on Feb 03, 2012 8:54 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Left by sasa on Feb 08, 2012 10:17 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application

Left by sasa on Feb 10, 2012 10:12 AM

Your comment:

 (will show your gravatar)