Solved

upgrade vb6 project with several dependancies to vb.net

Posted on 2013-06-09
9
354 Views
Last Modified: 2013-07-08
I have a project in vb 6 that has 5 dependencies

each is also a vb6 project.

I need to upgrade everything to vb.net.

do I combine all into 1 project?

what is the best approach
0
Comment
Question by:hainansyndrome
9 Comments
 
LVL 10

Expert Comment

by:Asim Nazir
ID: 39233987
Hi,

Try the upgrade solutions. Download and install this analyzer tool.

Go through this article for a detailed conversion strategy.
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 95 total points
ID: 39234713
Coming from 12 years of prior experience with VB6 and having now the same 12 years of experience with .NET, I can tell you that the best approach is to start from scratch in .NET.

Although VB6 and VB.NET have the same syntax, too many things are different to make conversion a good solution, unless you have a very simple project, which does not seem to be your case. .NET applications are not designed the same way. How you work with errors and databinding is very different. Many little things have no direct equivalent and need to be rewritten anyway. And a conversion does not use the extra possibilities of .NET, so you basically ends up with no gain at all. On the contrary, you end up with a buggy application that is most of the time slower than the original.

Most "real" projects I have seen converted through the converter ended up on the scratch pile after a few days, weeks or even a few months. And I am not talking about my own conversion projects, because I understood that after the first try. It comes from the hundreds of programmers that I meet each year in the VB.NET training sessions I give.

The result of a conversion is always a mess of code that no programmer would ever write. Experienced .NET programmers have often problems understanding that code because it does strange tricks in order to give in .NET the same result as it did in VB6. VB6 programmers think that they can learn from the generated .NET code, but you will learn nothing, because that is .NET code that emulates VB6, not true .NET code. Half of what it does is done through a Compatibility library that nobody uses when writing straight in .NET.

That code is buggy and hard to debugged because it is not clean .NET code. Not only will it be a pain to make the conversion work, but it will be a pain to maintain for as long as the application will be in use.

If your 5 dependencies are dlls for which you have the source code, you might have a way to go. Otherwise you will gain much by starting everything over in .NET. More work at first, but in the long run, it will pay with a more robust application that is easier to maintain, and you will learn to work properly in .NET.

You can start by rewriting only the application from scratch in .NET, and still use the dependencies as they are now. .NET can often work quite well with old dlls, unless they used the Variant datatype extensively. The Variant is no longer supported in .NET, and dlls that use them a lot usually do not work well with .NET applications.

Then, as the needs arise, rewrite each dependency in .NET, one by one.
0
 

Author Comment

by:hainansyndrome
ID: 39234950
The dependencies are DLL's
I just inherited this thing and although I will be rewriting this a lot I simply do not have the bandwidth to rewrite from scratch.
0
 
LVL 40
ID: 39235039
I suggest that you try running the converter on the main application. All you have to do is open the VB6 project in Visual Studio. This will give you a report of the things that need to be corrected. That will give you an idea of the amount of job you will still have to do after the conversion. Sure, this is something hard to evaluate if you do not have much experience in .NET, but it might help you figuring out if a conversion or a rewrite is the way to go.

And remember that a conversion might eventually work, but will be a mess that will be hard to maintain in the log run.

I understand that you do not have the source code for the dlls and cannot convert them to .NET. As I said before, they might work easily well the .NET application, but maybe not. It depends on how they were designed and the types they use. I would contact the providers to know if they have .NET versions or interop available for their COM dlls.

An interop is a bridge between .NET and COM and is something that you will need anyway. One will be created on the fly for you when you reference a COM dll in a .NET project. But these on the fly interops sometimes do not work well, so some vendors provide an interop that has been debugged and enables you to use the old dlls without problems.
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:hainansyndrome
ID: 39235051
ok

all the dll's were written in vb6 by the original author, I have their projects.
Should I try to combine all the projects into 1 project?
0
 
LVL 40
ID: 39235220
I would not try to combine them. There were probably reasons why the thing was develop in 6 parts instead of one big project.

And since you can first convert the application and test it with the old dlls, you will be able to see sooner if converting is a viable solution. If you do everything at once, it may takes you weeks before you have something that can run, and if you find out at that point that converting does not work, you will have lost a lot of time. This is the most typical conversion scenario I see, and it always fails.

You are lucky that the original programmer took the .exe with multiple .dll route. The only few conversions I have seen working in these 12 years were all designed that way.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39238933
In .NET, you can have many projects under same solution (cant remember if VS6 supported this) so you can keep all your projects separate but under a single solution.
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 39306583
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now