C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




DotNet COM Interoperability


Posted Date: 10 Oct 2008    Resource Type: Articles    Category: .NET Framework

Posted By: Palanivel       Member Level: Silver
Rating:     Points: 10



Introduction

I am very glade to share this article with you. This is a simple and useful example for COM interoperability. DOTNET Framework contains lots of components (eg: dll’s).
If we want to use external components this article will guide you better.

Overview

This article explains how to get synonym list for a particular word. To achieve this functionality I just take MS-Office component for my application.

Reference:

Go to Add Reference>COM>Microsoft Word 11.0 Object Library

Note: Word 11.0 version is based on MS-Office version.
10 for MS-Office 2000, 11 for MS-Office 2003 like that.


Form Design

This is windows application so you just design the form with one text box to read string and one Listbox control to display resultant synonyms.

Code Snippet

// Create object for Global Class

Word.GlobalClass gblObj = new GlobalClass();

// Define Language Object

object theLanguage = WdLanguageID.wdEnglishUS;

// Get all the synonym for particular string and store into synLst object

SynonymInfo synLst = gblObj.get_SynonymInfo(strInput, ref theLanguage);

// assign meaning list into object

object meanings = synLst.MeaningList;

// convert object value into array to display value one by one in the Listbox control

Array meaningList = (Array)meanings;
ListViewItem lv;

if (lstBoxSynonyms.Items.Count > 0)
{
lstBoxSynonyms.Items.Clear();
}

foreach (string meaning in meaningList)
{
// MessageBox.Show(meaning);

lv=new ListViewItem(meaning);

lstBoxSynonyms.Items.Add(lv.Text);
}



Conclusion
This sample should help beginners who are develop application using COM interoperability. For this application we no need to go for internet to search the meaning of the word. We can get result for resultant value by clicking the listbox text.



Attachments

  • DesktopDictionary (21736-10329-DesktopDictionary.zip)



  • Responses


    No responses found. Be the first to respond and make money from revenue sharing program.

    Feedbacks      
    Popular Tags   What are tags ?   Search Tags  
    Synonym list  .  Office application in DOT net  .  Meaning list  .  Dictionary  .  COM interoperability  .  

    Post Feedback


    This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
    You must Sign In to post a response.
    Next Resource: Refresh in Crystal Report Viewer
    Previous Resource: Files used in ASP.NET Application
    Return to Discussion Resource Index
    Post New Resource
    Category: .NET Framework


    Post resources and earn money!
     
    Related Resources



    dotNet Slackers   BizTalk Adaptors    Web Design

    conference calls

    Contact Us    Privacy Policy    Terms Of Use