.NET 2.0: code conversion from VB6 to C#

R

R.A.M.

Hello
I have a question to .NET programmers about code conversion from VB6
to C#.NET: is it possible? how much work must be performed manually?
Thank you very much for your answers.
/RAM/
PS. By the way, how about other languages like C++, C, Delphi, etc.?
 
M

Marina Levit [MVP]

Not having ever done it, I am guessing quite a bit of work.

However, it will be worth it if you do it right. Don't just do straght port,
think about how to take advantage of OO, the framework itself, etc. It might
mean restructuring your whole program.
 
B

Barry Kelly

R.A.M. said:
PS. By the way, how about other languages like C++, C, Delphi, etc.?

C++, C can be compiled possibly with some modification using C++/CLI.

Delphi can be compiled to .NET (currently 1.1 only) with the latest
versions of Delphi (E.g. BDS 2006).

-- Barry
 
S

sloan

It is not Trivial.

One error of alot of code rework:***

ADO (adodb) has been replaced with ADO.NET.

Minus the name, they have nothing in common.

What the conversion tool will do is ... rewrite the adodb stuff in dotnet
syntax.
However, it will refernce the adodb. com object.

This is a fudge patch. Its saying "I'm going to keep using the old com
object.. and not give you the code/advantage of the new ado.net stuff".

Is it possible? Yeah.

Is it seemless. No way.


I'd suggest finding someone who's been thru it to show you personally whats
going on.

You'll bite off more than you can chew, if you don't get some good advice.


***
There is alot an issue with how well you designed your vb app. If its
spaghetti'ed together, then you'd be best to rewrite the
requirements/business rules and start from scratch.

If you had good layers (Presentation, BusinessLogic, DataLayer ), then you
have a fighting chance.

...

This is just my opinion, since I had to do this once.
Now, I refuse to put "VB6" on my resume, for fear of re-doing that mess
again.
 
M

Mark Rae

I have a question to .NET programmers about code conversion from VB6
to C#.NET: is it possible? how much work must be performed manually?
Thank you very much for your answers.

There is no conversion from VB6 to C# - don't let anyone con you into
thinking there is.

VB6 and C# are syntactically very different, but that is completely
irrelevant. It is the fact that VB6 runs on the Visual Basic runtime
libraries and C# runs on the .NET Framework which is the major point here.
The two aren't similar in any way - not even remotely.

If you want to turn your VB6 app into a C# app, use the VB6 app as your
prototype, and begin the C# development from scratch.
 
J

Jon Davis

I think that despite the feedback of the others, this should be
straightforward. It will require four steps:

1. Migrate from VB6 to VB.NET. (Click da button.) Visual Studio comes with a
translator for this, and VB2005's translator is much better than VB.NET's.
2. Clean up migration failure points. You will have less of these if you
avoided COM objects, Variants, and default properties.
3. Migrate from VB.NET to C#. (Click da button.) You will need to find a
translator for this.
4. Clean up migration failure points. Since VB.NET is feature-comparable to
C# and VB.NET theoretically has a few stricter migration requirements since
it doesn't support case sensitivity, etc., I think there will be very few
failure points here.

You *can* use ADO classic and if you're just trying to get your stuff to
execute in the C# environment rather than the VB6 environment then a direct
port (or double-port rather) as described here should get you under way. You
can then go back and rewrite your database code with ADO.NET and replace
your other COM objects with managed equivalents.

Good luck.
 
G

Guest

It's not that bad - we have had experience with upgrading VB6 to VB.NET and
converting VB.NET to C# on large projects and our metrics were about 15,000
LOC/week for VB6 to VB.NET (using the wizard + many manual adjustments), and
about 50,000 LOC/week for VB.NET to C# conversion (using our Instant C#
VB.NET to C# converter and some manual adjustments).
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter & VB to C++ converter
Instant J#: VB to J# converter
 
M

Michael D. Ober

Jon Davis said:
I think that despite the feedback of the others, this should be
straightforward. It will require four steps:

1. Migrate from VB6 to VB.NET. (Click da button.) Visual Studio comes with a
translator for this, and VB2005's translator is much better than VB.NET's.

This migration doesn't work for anything more complex than Hello, World. It
works for small sections of code, but forget about it for applications.
2. Clean up migration failure points. You will have less of these if you
avoided COM objects, Variants, and default properties.

By the time you've completed this step - you could have completely rewritten
the app in either VB.Net or C#.
3. Migrate from VB.NET to C#. (Click da button.) You will need to find a
translator for this.
4. Clean up migration failure points. Since VB.NET is feature-comparable to
C# and VB.NET theoretically has a few stricter migration requirements since
it doesn't support case sensitivity, etc., I think there will be very few
failure points here.

You *can* use ADO classic and if you're just trying to get your stuff to
execute in the C# environment rather than the VB6 environment then a direct
port (or double-port rather) as described here should get you under way. You
can then go back and rewrite your database code with ADO.NET and replace
your other COM objects with managed equivalents.

Good luck.

Mike Ober.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top