Using a VB6 Class in C#

╄→尐↘猪︶ㄣ 提交于 2019-12-18 05:41:21

问题


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


回答1:


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.




回答2:


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

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




回答3:


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




回答4:


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



来源:https://stackoverflow.com/questions/2257883/using-a-vb6-class-in-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!