Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to wrap a .Net program in a COM object 5

Status
Not open for further replies.

ITmfgCO

IS-IT--Management
Sep 14, 2006
25
0
0
US
I have a VB5 .net program written with Microsoft's Visual Studio 2005 package...
Due to my unfamiliarity with VB .Net I have not been able to make the Com base application call the .Net program. After some research I was told that the .Net program needs to be wrapped in Com Object......

If anyone can walk me trough wrapping the .Net code in a Com Object and how to call it from this Com based application that would be great....

Thanks,

- in a little bit of a pickle

 
ITmfgCO,

Writing a .NET type and consuming that type from unmanaged code are distinct activities for developers. Following links describe several tips for writing managed code that interoperates with COM clients:

To develope a managed type fom COM
Qualifying .NET types for interoperation.
All managed types, methods, properties, fields, and events that you want to expose to COM must be public. Types must have a public default constructor, which is the only constructor that can be invoked through COM.

Applying interop attributes.
Custom attributes within managed code can enhance the interoperability of a component.

Packaging an assembly for COM.
COM developers might require that you summarize the steps involved in referencing and deploying your assemblies.


Additionally, following links identify the tasks related to consuming a managed type from a COM client.

To consume a managed type from COM
Register assemblies with COM.
Types in an assembly (and type libraries) must be registered at design time. If an installer does not register the assembly, instruct COM developers to use Regasm.exe.

Reference .NET types from COM.
COM developers can reference types in an assembly using the same tools and techniques they use to refer other COM types.

Call a .NET object.
COM developers can call methods on the .NET object the same way they call methods on any unmanaged type.

Deploy an application for COM access.
A strong-named assembly can be installed in the global assembly cache and requires a signature from its publisher. Assemblies that are not strong named must be installed in the application directory of the client.


Hope it helps you a lot.

 
Excellent post computerjin

Have a star

[sub]____________ signature below ______________
You are a amateur developer until you realize all your code sucks.
Jeff Atwood[/sub]
 
But you knew what I did not.

Another star!

Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.
 
RonRepp,

My pleasure. Sharing positive knowledge is a wonderful thing in this world of information. Thank you so much for this appraisal.

 

I have posted this information in FAQs section. You can review it and if you think it is useful information then you can cast your vote for this FAQ.

faq796-6664

Thank you for your support.

 

Thank you all of you for your appraisal. It will be great pleasure for me if my post helps someone in his/her work. Thank you for boosting me up.
 
computerjin,

This helped me greatly, I was successful in completing my this project. Thanks again...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top