Can .Net custom controls be used in VB6 form?

a 夏天 提交于 2019-12-05 20:59:50

问题


I am doing some maintenance on a VB6 Windows application. I have a .Net custom control component that I would like to use on a VB6 form. Is this possible? I know how to access non-visual .Net components from VB6 by generating a COM type library for the .Net DLL, but can a .Net custom control be used like a .OCX from VB6? If so, how is the control instantiated in VB6, added to the form, etc.

Thanks in advance for any replies.


回答1:


The Interop Forms toolkit will give you what you need:

http://msdn.microsoft.com/en-us/vbasic/bb419144.aspx

It lets you create UserControls in VB.net which you can then add to VB6. It also lets you display .net forms from your VB6 code.

I've used it successfully to give my old VB6 code the .net toolbars - much nicer!




回答2:


This will lead you step by step through the process.

http://www.codeproject.com/KB/vb-interop/UsingDotNETControlsInVB6.aspx

It is not a perfect fit so you will have to explore how badly the limitations effect you.



来源:https://stackoverflow.com/questions/459250/can-net-custom-controls-be-used-in-vb6-form

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