We have legacy VB6 Application and we are trying to move this to C#. As phase one we have created starting Form in C#(with similar controls) and want this C# app to communicate with VB6 starting form so that when user clicks on c# form it will initiate button click event on VB6 Starting form(which we wants it to be hidden) They both share same database, could some one please give me an idea about how we can achieve this or is there any other way. Thanks
Asked
Active
Viewed 113 times
2
-
so I have a few questions but will try to keep them brief and simple.. 1. Can the VB6 legacy code be converted to C# or VB.NET 2. If you can convert the code to VB.NET you can still reference the VB.Net assemblies by adding `using Microsoft.VisualBasic` to the C# Class header ... If that's not an option then I would look up how to export dll functions or google how to call vb6 dll in C# – MethodMan Mar 04 '15 at 22:26
-
1possible duplicate of [upgrade program for converting vb6 app to C#](http://stackoverflow.com/questions/8192403/upgrade-program-for-converting-vb6-app-to-c-sharp) – WorkSmarter Mar 04 '15 at 22:27
-
3When you are trying to retire the VB6 app, why keep it around and try to control it? If there's some complex business logic you might be able to move it to a separate VB.net assembly and then reference that from your c# application. Moving code from VB6 to VB.net is widely documented an can, depending on the original code, a strait forward process. My suggestion is to either really retire the application/throw it away, or keep it, but don't start mixing it... – Chief Wiggum Mar 04 '15 at 22:29
-
3A few years ago we faced the same challenge: We decided to make it a hybrid application: we made the VB6 application a dll (ok, 5 dll´s), and at this point we had only an empty C# "Startup" form. Form by form, we wrote it new from scratch. Hard but possible (most important start hint: make the C# a target x86) – Thomas Krojer Mar 05 '15 at 06:29
1 Answers
1
This can be a good idea if the VB6 code is too large to completely rewrite from scratch. You can split the VB6 into separate DLLs and then replace the DLLs piecemeal with C# DLLs using COM-interop so that VB6 and C# talk to each other.
For instance have a look at some of the answers to this question