Create CSharp user control for VB6

来源:互联网 发布:plc电动机正反转编程 编辑:程序博客网 时间:2024/06/06 02:31
 
  1. Install Microsoft Interop Forms Toolkit 2.0 which you can download from http://www.microsoft.com/downloads/details.aspx?FamilyId=934DE3C5-DC85-4065-9327-96801E57B81D&displaylang=en#filelist
  2. Create a VB6 Interop UserControl project (InteropUserControlLibrary) in VS2005 or VS2008. This project could be selected only after installing the Microsoft Interop Forms toolkit.

In this project, there is 1 file (InteropUserControl.vb) which you could add any windows control or controls built in csharp.

  1. Build the project and add the component in VB6 by Project->Components. Then you could drag the user control anywhere in VB6.

 

Install Interop Forms Toolkit 2.0

Installing the toolkit is fairly straightforward. Navigate to the Toolkit Download Site and, of the three downloads available, run the InteropFormsInstaller.msi file. In most cases, this is all you need to do. When you open the Visual Studio .NET IDE, you should find the new templates, VB6 Interop UserControl and VB6 Interop Form Library, available when you create a new VB.NET project. Under your Tools menu, you should also find a new wizard labeled "Generate InteropForm Wrapper Classes".

If the new wizard does not appear in your Tools menu, there may have been a problem installing it. Check Tools | Add-in Manager to make sure that this wizard is selected. If it is present and selected in the Add-in Manager, but still does not appear in your Tools menu, you can run the following command in your command line to reset it: Devenv /resetaddin Microsoft.InteropFormTools.InteropFormProxyGenerator.Connect.

 

原创粉丝点击