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

Interop VB6 Interface to .NET

Status
Not open for further replies.

DerPflug

Programmer
Mar 28, 2002
153
0
0
US
Is it possible to create a VB6 interface that can be implemented in a .NET class? I have the need to call a method in an existing VB6 class that behind the scenes will call either a VB6 or .NET class that utilize the same interface. For instance....

Code:
MyObject.Type = "clsVB6"
MyObject.DoSomething(intID)

would behind the scenes be utilizing a VB6 class that implemented a 'DoSomething' interface method. Similarly...

Code:
MyObject.Type = "clsNET"
MyObject.DoSomething(intID)

would utilize a .NET class that implemented a 'DoSomething' interface method. My vision for this is that MyObject would be a VB6 interface that contained the clsVB6 and MyObject would interop to the clsNET. Have I thought this out correctly? It's convoluted but the 'MyObject.DoSomething' line is called in tons of VB6 code and I have to find a way to implement this without having to change all of the existing VB6 code that calls MyObject.

Thanks in advance for any help.
 

Compile the vb6 class as a dll, with DoSomething as a public method. Register the dll on your computer, then create a reference to it in your VB .NET project. You should be able to instantiate objects from the vb6 class.



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top