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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating COM in VB.NET for VB6

Status
Not open for further replies.

CFB

Programmer
Jan 11, 2001
74
US
I'm just learning (and getting used to) the .NET framework. I've done some searching around (including these forums) and from what I understand, the use/creation of COM objects has been done away with/changed the introduction of .NET. I can't seem to nail down the specific answer to my question though.

Is it possible to create a VB.NET COM component that could be used by a VB6 application? We've got several VB6 apps that need to use Web Services and I thought it'd be easier to create a VB.NET COM component to access these services via VB6 than it would be to implement the SOAP toolkit. Any help is appreciated. Thanks.
 
Yes you can create a component that is callable by COM. You create a .Net component that can be called by COM through a a Com Callable Wrapper. However, the Net Framework must be installed on all machines that will use the .Net Component.

"NET Framework Developer's Guide

COM Callable WrapperSee Also
COM Wrappers | COM Callable Wrapper | Simulating COM Interfaces | Runtime Callable Wrapper | Exposing .NET Framework Components to COM
When a COM client calls a .NET object, the common language runtime creates the managed object and a COM callable wrapper (CCW) for the object. Unable to reference a .NET object directly, COM clients use the CCW as a proxy for the managed object.

The runtime creates exactly one CCW for a managed object, regardless of the number of COM clients requesting its services. As the following illustration shows, multiple COM clients can hold a reference to the CCW that exposes the INew interface. The CCW, in turn, holds a single reference to the managed object."


Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
I haven't done this in VB.NET, but in C# creating a CCW is an option in the project properties -- look for "register for COM Interop" or something similar.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top