views:

675

answers:

10

I have a VB5 (non .net) project that I would like to upgrade to a c# project. Has anyone have any suggestions on methods or free tools that are avalible to help me with this.

Thanks

Brad

+16  A: 

You are better off with a straight rewrite.

Otávio Décio
I wanted the UI to look the same so I converted the VB5 to VB8 using(vs2008) and copied the UI ellements over to the C# project. I then inspected each procedure and wrote new functions from the generated VB from the IDE. It took 2 days to get it up and running- small project lees than 2000 LOC.
Brad
Not too bad, I'd say. Sometimes we just need to bite the bullet.
Otávio Décio
A: 

I know there exist a conversion tools, not sure though if there are some for vb5.

However, i'd recommend performing a redesign of the project, taking advantage of the .net features unavaiable in vb5. Specially it would be good redesigning for a OO language.

Rafa G. Argente
+1  A: 

What I would suggest is first convert the project to VB6. It'll be much easier to go forward from there. There are a number of tools to help you do this. There is VBMigration Partner and there is vbto. I've not tried either so YMMV.

If costs are a constraint you could try this: there is a wizard in Visual Studio that will attempt to upgrade VB6 to VB.NET. It's not 100% accurate and you WILL have to write code for things VB.NET does not support such as control arrays, etc. Once the code is in VB.NET you can use a tool like SharpDevelop to convert the VB.NET to C#. It'll be a bit tedious but i suppose all roads, no matter how convoluted, lead to Rome.

Conrad
A: 

If you're about to convert VB5 to .NET (whether it's C# or even VB.NET) the fastest way is to restart from 0 your implementation so you can take full advantage of .NET Framework classes. I don't know if there are tools to do this conversion automatically.

Stefano Driussi
+1  A: 

In case you were able to migrate it to VB6 you can use the code advisor to see how you can fix your project to be compatible to vb.net, then you can migrate to vb.net, in case it success, you can use this tool to convert it to c# or the Reflector.

I give it a chance of 1x10^(-100)% to work. Good luck.

pablito
A: 

Migrating VB5 to C# just to have .NET is never a good reason. I would prefer to have a good look at the assumptions and design decisions I made in the VB5 version, rethink them all, add new ideas, sketch the UI and improve it to look closer to a modern one.

Then it's a new project, I wouldn't even call it a rewrite, because so much would have changed.

Osama ALASSIRY
Reason being is that i dont have a complier for VB5
Brad
A: 

I've migrated a small 1-tier VB6 application to C# and I will never do it again.

There are applications out there that do a rather good job migrating from VB6 to VB.Net.

//Magnus

A: 

It's rarely a good idea to do a strict conversion from one language to another, particularly when they are as different as VB5 and C#.

Theoretically, you could convert VB5 to VB6 and then VB6 to VB.NET and then VB.NET to C#, but that just sounds crazy to me as I type it.

C# is so much more powerful than VB5 that you wouldn't want to covert the code anyway. After all, it likely has a poor design due to VB's weak OO capabilities.

I'd instead recommend re-implementing the functionality you need in C# (or whatever other language you want to use).

Paul Lefebvre
A: 

I’ve done it in the past but don’t recommend it. Getting the project to work correctly after the ‘auto-migration’ was not worth the effort. I ended up rewriting the program and was better off because of it.

Abel
A: 

Having done this myself I talk about the issues involved here.

Basically as ocdecio you are looking at least a partial rewrite. You will likely need to refactor your forms to move as much code out of them as possible. You will also need to refactor any VB6 specific features to work behind a interface that you can reimplement in .NET. Notably the Graphics commands, and the Printer functions. Migration Tools are usually worthless for any serious project.

RS Conley