Hello
I have a question about whats the best way to integrate a .Net application into an "old" VB6 application.
The current problem is that we need to rewrite "parts" of the application and need to incorperate those "parts" into an old legacy System... This system is written in VB6 and the goal would be to make this possible with the smallest amount of changes to the VB6 code. I was thinking about creating a plugin or something like that which would have its own form or controls and only require a very "minimalistic interface" (like show())
Are there any patterns which I should take a closer look at or has anyone a suggestion on what would work best
The "part" of the system will cover about 20 tables (about 5-8 non lookup) and a whole bunch of reports

Integrating .Net into a VB6 client
Umberto
Well...
That is no option... Its quite easy to use the framework in VB6... I just need to create a CCW and stuff the whole stuff into the GAC. If i keep a small interface this should pose no problems...
But I am still open to other sugestions (Besides rewriting the legacy system.. Since its not "mine" and we only have a fixed-price Project)
Patrick C
An interesting podcast which deals with exactley the sceanrio you are talking about
http://dotnetrocks.com/default.aspx showID=187
This highlights an approach taken to incrementally move a VB6 application to .NET and some of the pitfalls. Interesting listening.
R.Tutus
Hi, Hatzi,
See if this post helps:
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=565119&SiteID=1
--Matt--*
Minway
ChocolateBob
GraemeWhelan
I thought the original poster was talking about from .NET to VB6 or did I misinterpret something

My apologies if I did :-)
Pockey
We just did this for our application. The majority of it is still in VB6 - but some parts were moved to .NET.
In the .NET application, we created a single entry point. Any VB6 code just calls "LaunchFeature" to launch a particular .NET feature (primarily a form). The code looks basically like this:
Public Sub LaunchFeatureWithParameters(ByVal sFormName As String, ByRef arrParameters As Object()) Dim sClassName As String = "" Dim sFullName As String = "" Try ' Define the name of the component to executesClassName =
"myWin"sFullName =
"myWin." & sFormName ' Load the assembly containing the DLL, if necessary If _WinAssembly Is Nothing Then _WinAssembly = [Assembly].Load(sClassName) End If ' Define the appropriate class Dim oType As Type = _WinAssembly.GetType(sFullName) ' Create an instance of the form and show it, ' Passing in the parameters as needed Dim frm As Formfrm =
CType(Activator.CreateInstance(oType, arrParameters), Form) If Not frm Is Nothing Then frm.Show() End If Catch ex As Exception' Handle the error
End Try Return End SubSo the only parts of the VB6 code that was modified was the code to call the .NET features (and of course the code that was repaced with the .NET code).
Hope this helps.
newbie1a
I tell Dot Net Rocks is just a great show for listening to different technologies and people using the microsoft products.
Nathan Blevins
Thanks folks...
That is exactly the stuff i was looking for... Nice show and its exactly what i need to do :)
And the codesnippet also looks helpfull
nikki01
Yes... Thats basically what I am doing right now...
I am writing a "Form" Control which encapsulates the whole Form as a "simple" usercontrol. At runtime I load those controls as needed and display them in a Form to let the user work with them.
slippyC
No you didnt miss something but what this does talk about is not allowing the whole solution to be ported in one shot and having to take an incremental approproach which requires you to move some components to .NET and keep the VB6 running with these new .NET components and doing a series of releases where you are moving small pieces at a time but preserving the application as a production application until you have ported much of it over to .NET
The key part to this approach is making .NET code work with legacy VB6 code - and this is addressed in the podcast.