.Net自定义控件可以VB6形式使用吗?
我正在对VB6 Windows应用程序进行一些维护。我有一个要在VB6表单上使用的.Net自定义控件组件。这可能吗?我知道如何通过为.Net DLL生成COM类型库来从VB6访问非可视.Net组件,但是.Net自定义控件可以像VB6中的.OCX一样使用吗?如果是这样,则如何在VB6中实例化控件,将其添加到表单中,等等。
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.
在此先感谢您的答复。
Interop表单工具包将为您提供所需的信息:
The Interop Forms toolkit will give you what you need:
http://msdn.microsoft.com/en-us/vbasic/bb419144.aspx
它使您可以在VB.net中创建UserControl,然后可以将其添加到VB6。
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.
我已经成功地使用它为我的旧VB6代码提供了.net工具栏-更好了!
I've used it successfully to give my old VB6 code the .net toolbars - much nicer!