James Jeffery
James Jeffery

Reputation: 12579

Using a VB6 Class in C#

Is it possible to use a VB6 class in C#?

Upvotes: 14

Views: 2207

Answers (4)

Kb.
Kb.

Reputation: 7400

As @Wayne states in his post (+1) it is absolutely possible.

I would go for a rewrite of your VB6 class:
If you have the VB6 source and the funding, I would recommend you to rewrite the class in C#.
Although VB6 may live forever :
Current support Statement for Visual Basic 6.0

Upvotes: 3

lesscode
lesscode

Reputation: 6361

I think you should just be able to add the library that contains your VB6 type as a reference in your C# project. Visual Studio will create an Interop Assembly on the fly, and you'll get access to all of the types in the VB6 library via Runtime Callable Wrappers.

The tool that creates the Interop Assembly is TLBIMP.EXE, and you can run this yourself if you want more control over the process, eg. if you want to create a Primary Interop Assembly that might be shared by multiple managed components.

Upvotes: 12

Jason
Jason

Reputation: 89092

You can use a compiled VB6 dll in a C# program by using COM Interop.

https://stackoverflow.com/questions/tagged/interop

Upvotes: 3

Otávio Décio
Otávio Décio

Reputation: 74250

Sure, you just need to make it a COM object.

Upvotes: 0

Related Questions