Geeks With Blogs
Shervin Shakibi's Blog blog

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

 

Posted on Wednesday, November 5, 2008 3:42 PM | Back to top


Comments on this post: Using Words Spellcheck and grammer check with your windows Forms application

# 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...
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...
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
Requesting Gravatar...
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
Requesting Gravatar...
Left by Jusmine on Jul 05, 2011 12:18 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application
Requesting Gravatar...
Left by Jusmine on Jul 06, 2011 6:23 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application
Requesting Gravatar...
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

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

# re: Using Words Spellcheck and grammer check with your windows Forms application
Requesting Gravatar...
Left by Loung on Dec 05, 2011 1:07 AM

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

# re: Using Words Spellcheck and grammer check with your windows Forms application
Requesting Gravatar...
Left by Loung on Dec 06, 2011 9:26 PM

# re: Using Words Spellcheck and grammer check with your windows Forms application
Requesting Gravatar...
Left by Loung on Dec 13, 2011 9:32 PM

# re: Using Words Spellcheck and grammer check with your windows Forms application
Requesting Gravatar...
Left by Loung on Jan 29, 2012 11:08 PM

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

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

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

# re: Using Words Spellcheck and grammer check with your windows Forms application
Requesting Gravatar...
Left by sasa on Feb 08, 2012 10:17 AM

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

# re: Using Words Spellcheck and grammer check with your windows Forms application
Requesting Gravatar...
Left by sasa on Feb 13, 2012 9:30 AM

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

# re: Using Words Spellcheck and grammer check with your windows Forms application
Requesting Gravatar...
Left by sasa on Feb 16, 2012 11:08 AM

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

# re: Using Words Spellcheck and grammer check with your windows Forms application
Requesting Gravatar...
Left by sasa on Feb 25, 2012 9:05 AM

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

# re: Using Words Spellcheck and grammer check with your windows Forms application
Requesting Gravatar...
Left by sasa on Apr 04, 2012 10:18 AM

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

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

# re: Using Words Spellcheck and grammer check with your windows Forms application
Requesting Gravatar...
Left by sasa on May 15, 2012 10:04 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application
Requesting Gravatar...
Thanks for that, works a treat apart from a small aspect. The spellcheck box often appears behind other forms and so the users do not see it and simply think that the system has hung.

Any ideas on always making it appear on top?
Left by Don C on Jul 04, 2012 6:29 AM

# re: Using Words Spellcheck and grammer check with your windows Forms application
Requesting Gravatar...
Thanks for that nice part of code. It is very useful to share the standard and user dictionaries of MS-Word with other applications.
Left by Harald K on Sep 01, 2012 1:47 PM

# re: Using Words Spellcheck and grammer check with your windows Forms application
Requesting Gravatar...
This article is something that will help me with my class assignment. It helped me to better understand another aspect of this topic. Thanks.
definition essay writing
Left by denas on Dec 20, 2012 5:37 AM

Your comment:
 (will show your gravatar)


Copyright © Shervin Shakibi | Powered by: GeeksWithBlogs.net