Click here to Skip to main content
15,885,680 members
Articles / Operating Systems / Windows
Article

VB6 - C# Interop Form Toolkit

Rate me:
Please Sign up or sign in to vote.
4.57/5 (11 votes)
2 Oct 2006CPOL2 min read 196.8K   3.8K   26   49
Interop Form Toolkit was released few days ago. It allows an easy creation of mixed VB6/VB.NET application. One thing it is missing is the ability to do it in C#.
Sample Image - newproject.gif

Introduction

After a long period of talking and expectation Interop Form Toolkit is finally released. I blogged about it few days ago here. If you have an existing VB6 application and are considering options to combine it with new .NET module, you definitely need to check it out.

After couple of hours playing with Interop Form Toolkit, one thing I could not understand is "why it supports VB.NET only?" So I decided to fix this injustice.

Two things should be replaced to make the toolkit work perfectly well with C#: Project template and Add-In for Wrapper objects creation. First of all, I created a new C# project template ("VB6 Interop Form Library C#") and a new item template ("C# Interop Form"). Now you will be able to create a new C# project from this template and add new forms with all needed references and attributes. The original Add-In does not bother even to check in which language the current project is written. It assumes that the only possible choice is VB.NET. Add-In creates a wrapper object and deals with public constructors, properties, methods and events. It will add to wrapper only public members marked with one of Interop Toolkit attributes (InteropFormProperty for example). New Add-In can replace the existing one. It can generate wrappers both in C# and VB.NET, based on project language. If you will invoke it in mixed VB.NET/C# solution, for each, project wrappers will be created in the correct language.

Notes

  • Other .NET languages except VB.NET and C# are still ignored.
  • I can only take credit mostly for translation work. Creators of the original Toolkit deserve a lot of thanks.
  • It is unsupported and definitely not a bullet proof tool. Please let me know about problems or feel free to fix the attached code.

Installation

I apologize for not creating the setup for this, but installation is very easy. First of all, you will need to download and install Interop Form Toolkit. Then, you need to copy template zip files into template directories (usually project template will go into ...\My Documents\Visual Studio 2005\Templates\ProjectTemplates\Visual C#\Windows, and item template into ...\My Documents\Visual Studio 2005\Templates\ItemTemplates). And the last one: copy add-in files into Visual Studio 2005 Add-Ins directory (...\My Documents\Visual Studio 2005\Addins).

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Israel Israel
Leon works as Chief Architect at SRL Group. He leads architectural design and development of various enterprise level projects.
You can meet him on user groups, conferences and forums dedicated to Architecture, ASP.NET, Team System etc. or join him for the next white water rafting adventure

Comments and Discussions

 
QuestionWhat about TAB??????? Pin
hav29a19-Feb-07 2:54
hav29a19-Feb-07 2:54 
AnswerRe: What about TAB??????? Pin
cosmicarts8-Aug-07 9:11
cosmicarts8-Aug-07 9:11 
Questioncan only add one form Pin
clovisA1232-Feb-07 4:14
clovisA1232-Feb-07 4:14 
QuestionHow to use with VS6 C++ Pin
Joe Calabrese5-Jan-07 6:25
Joe Calabrese5-Jan-07 6:25 
General.Net user controls in Vb6 Pin
Kodici5-Jan-07 2:02
Kodici5-Jan-07 2:02 
QuestionHow to open c# form in MDIChild in VB6 ? [modified] Pin
lake117-Dec-06 4:23
lake117-Dec-06 4:23 
GeneralNew to .Net not sure of what the install entails. Pin
Skater Dude25-Oct-06 10:40
Skater Dude25-Oct-06 10:40 
GeneralRe: New to .Net not sure of what the install entails. Pin
Leon Langleyben25-Oct-06 21:36
Leon Langleyben25-Oct-06 21:36 
Hi Skater,
There are two template zip files in InteropFormCSBinaries.zip
I suggest you to put at "VB6 Interop Library C#.zip" into [C:]\Documents and Settings\[User Name]\My Documents\Visual Studio 2005\Templates\ProjectTemplates\Visual C#\Windows (Make sure to replace [C:] and [User Name] with actual drive and folder names). The other one ("C# Interop Form.zip") should go into ...\My Documents\Visual Studio 2005\Templates\ItemTemplates. AddIn (files InteropFormAddIn.AddIn and InteropFormAddIn.dll) should go into \My Documents\Visual Studio 2005\AddIns directory.

Hope it helps, if not, let me know.
Regards,
Leon

------------------------
Langleyben Leon
Software Architect
MCSD

SRL Group ltd
leon@srl.co.il
972-54-4860715
972-3-7662020

GeneralRe: New to .Net not sure of what the install entails. Pin
grxie10-Jul-07 10:23
grxie10-Jul-07 10:23 
GeneralCall from vb6 creates a form not in project. Pin
WebMaster28-Sep-06 9:20
WebMaster28-Sep-06 9:20 
GeneralRe: Call from vb6 creates a form not in project. Pin
Leon Langleyben3-Oct-06 7:19
Leon Langleyben3-Oct-06 7:19 
GeneralIt keeps generating wrappers in VB when using C# Pin
Mario A Vasquez25-Sep-06 9:05
Mario A Vasquez25-Sep-06 9:05 
AnswerRe: It keeps generating wrappers in VB when using C# Pin
Leon Langleyben25-Sep-06 11:42
Leon Langleyben25-Sep-06 11:42 
GeneralRe: It keeps generating wrappers in VB when using C# Pin
Mario A Vasquez25-Sep-06 12:15
Mario A Vasquez25-Sep-06 12:15 
GeneralRe: It keeps generating wrappers in VB when using C# Pin
Leon Langleyben25-Sep-06 12:09
Leon Langleyben25-Sep-06 12:09 
GeneralRe: It keeps generating wrappers in VB when using C# Pin
Mario A Vasquez25-Sep-06 12:23
Mario A Vasquez25-Sep-06 12:23 
GeneralRe: It keeps generating wrappers in VB when using C# Pin
Leon Langleyben27-Sep-06 2:09
Leon Langleyben27-Sep-06 2:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.