[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

Converting VB6 to C#

stephenwo

8/20/2008 9:21:00 PM

I have a large VB6 code base that I need to convert to C#. I am
assuming that the best approach would be to first convert it to VB.NET
and get it into a compilable state, then to convert it to C# from
VB.NET.

Problem: I see a lot of converters out there that do a pretty good
job of performing the conversion. But most of the ones I see do this
on a file by file basis rather than a project by project basis.

So: what's the best converter out there that will take a VB.NET
project as input and produce a C# project with converted code as
output?

Thanks,

Stephen
12 Answers

Family Tree Mike

8/20/2008 9:59:00 PM

0

Visual Studio 2003/2005/2008 can read the vb6 project and convert it to
VB.Net.

What is the purpose of going to C#? C# and VB.Net can call each other
easily.

"Stephen" <stephenwo@gmail.com> wrote in message
news:c5760f3e-8004-42e2-8627-a97992c2d34a@w1g2000prk.googlegroups.com...
>I have a large VB6 code base that I need to convert to C#. I am
> assuming that the best approach would be to first convert it to VB.NET
> and get it into a compilable state, then to convert it to C# from
> VB.NET.
>
> Problem: I see a lot of converters out there that do a pretty good
> job of performing the conversion. But most of the ones I see do this
> on a file by file basis rather than a project by project basis.
>
> So: what's the best converter out there that will take a VB.NET
> project as input and produce a C# project with converted code as
> output?
>
> Thanks,
>
> Stephen

David Anton

8/21/2008 12:16:00 AM

0

To convert entire projects, solutions, folders, or ASP.NET in-line code,
you'll have to look at commercial converters.
--
http://www.tangiblesoftwaresol...
C++ to C#
C++ to VB
C++ to Java
VB & C# to Java
Java to VB & C#
Instant C#: VB to C#
Instant VB: C# to VB
Instant C++: VB, C#, or Java to C++/CLI


"Stephen" wrote:

> I have a large VB6 code base that I need to convert to C#. I am
> assuming that the best approach would be to first convert it to VB.NET
> and get it into a compilable state, then to convert it to C# from
> VB.NET.
>
> Problem: I see a lot of converters out there that do a pretty good
> job of performing the conversion. But most of the ones I see do this
> on a file by file basis rather than a project by project basis.
>
> So: what's the best converter out there that will take a VB.NET
> project as input and produce a C# project with converted code as
> output?
>
> Thanks,
>
> Stephen
>

Stevie

8/21/2008 12:53:00 AM

0

Stephen wrote:

> I have a large VB6 code base that I need to convert to C#. I am
> assuming that the best approach would be to first convert it to VB.NET
> and get it into a compilable state, then to convert it to C# from
> VB.NET.
>
> Problem: I see a lot of converters out there that do a pretty good
> job of performing the conversion. But most of the ones I see do this
> on a file by file basis rather than a project by project basis.
>
> So: what's the best converter out there that will take a VB.NET
> project as input and produce a C# project with converted code as
> output?


I found this:

http://www.instantcsharp.com/Product_Details/Instant_...

but it translates VB.NET code into C#.

IMHO the right way is to do the VB6 -> C# translation by hand directly
without using external tools.

And yes, this will be _quite_ time-consuming.

But hey, just try to convert a VB6 class to VB.NET with the tool that
comes with Visual Studio, and you'll see that what you obtain is a
*large* amount of warnings and errors. In my opinion, it will take much
more time to resolve that warnings than converting the code by hand (and
I guess this will be particularly true if your VB6 code makes a lot of
calls to Windows APIs).

Also, I believe that converting VB6 to VB.NET only with an external tool
could produce some not-so-reliable results (maybe some subtle changes
here and there, that could introduce some very hard-to-find bugs).
Probably, converting VB.NET code you obtained in such a way to C# may
lead to even worse results.

Quite frankly, I think that reviewing the resultant code would be a big
loss of time.

Converting by hand also gives you the opportunity to refactor your code,
and to improve its architecture taking advantage of current
object-oriented best practices.

I guess it all probably boils down to a matter of personal taste: I
surely would prefer to spend some time to refactor my code to obtain
something that will last - I guess - for years instead of spending
endless hours fixing warnings and doing bug-hunting on something
produced by an automatic tool (which, in my opinion, will never be able
to substitute a developer).



Just my 2 cents.


--
S.

Patrice

8/21/2008 7:49:00 AM

0

Plus another option could be :

http://msdn.microsoft.com/en-us/vbrun/de... (discuss VB6/VB2005
interop)

It targets VB6/ VB2005 but I don't see why most of this material wouldn't
apply to C# as well especially if the goal is to be able to add new features
using .NET in this existing code base...


--
Patrice


"Stevie" <jstevie__@__gmail__.com> a écrit dans le message de groupe de
discussion : 703rk.21632$0N.20577@tornado.fastwebnet.it...
> Stephen wrote:
>
>> I have a large VB6 code base that I need to convert to C#. I am
>> assuming that the best approach would be to first convert it to VB.NET
>> and get it into a compilable state, then to convert it to C# from
>> VB.NET.
>>
>> Problem: I see a lot of converters out there that do a pretty good
>> job of performing the conversion. But most of the ones I see do this
>> on a file by file basis rather than a project by project basis.
>>
>> So: what's the best converter out there that will take a VB.NET
>> project as input and produce a C# project with converted code as
>> output?
>
>
> I found this:
>
> http://www.instantcsharp.com/Product_Details/Instant_...
>
> but it translates VB.NET code into C#.
>
> IMHO the right way is to do the VB6 -> C# translation by hand directly
> without using external tools.
>
> And yes, this will be _quite_ time-consuming.
>
> But hey, just try to convert a VB6 class to VB.NET with the tool that
> comes with Visual Studio, and you'll see that what you obtain is a *large*
> amount of warnings and errors. In my opinion, it will take much more time
> to resolve that warnings than converting the code by hand (and I guess
> this will be particularly true if your VB6 code makes a lot of calls to
> Windows APIs).
>
> Also, I believe that converting VB6 to VB.NET only with an external tool
> could produce some not-so-reliable results (maybe some subtle changes here
> and there, that could introduce some very hard-to-find bugs). Probably,
> converting VB.NET code you obtained in such a way to C# may lead to even
> worse results.
>
> Quite frankly, I think that reviewing the resultant code would be a big
> loss of time.
>
> Converting by hand also gives you the opportunity to refactor your code,
> and to improve its architecture taking advantage of current
> object-oriented best practices.
>
> I guess it all probably boils down to a matter of personal taste: I surely
> would prefer to spend some time to refactor my code to obtain something
> that will last - I guess - for years instead of spending endless hours
> fixing warnings and doing bug-hunting on something produced by an
> automatic tool (which, in my opinion, will never be able to substitute a
> developer).
>
>
>
> Just my 2 cents.
>
>
> --
> S.


Cowboy

8/21/2008 2:31:00 PM

0

Consider VB Conversions. You can read my review and competitive analysis
(with requisite disclaimer that one was a full version and another a demo):
http://gregorybeamer.spaces.live.co...!B036196EAF9B34A8!786.entry

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/Greg...

or just read it:
http://feeds.feedburner.com/Gre...

********************************************
| Think outside the box! |
********************************************
"Stephen" <stephenwo@gmail.com> wrote in message
news:c5760f3e-8004-42e2-8627-a97992c2d34a@w1g2000prk.googlegroups.com...
>I have a large VB6 code base that I need to convert to C#. I am
> assuming that the best approach would be to first convert it to VB.NET
> and get it into a compilable state, then to convert it to C# from
> VB.NET.
>
> Problem: I see a lot of converters out there that do a pretty good
> job of performing the conversion. But most of the ones I see do this
> on a file by file basis rather than a project by project basis.
>
> So: what's the best converter out there that will take a VB.NET
> project as input and produce a C# project with converted code as
> output?
>
> Thanks,
>
> Stephen

David Anton

8/21/2008 3:56:00 PM

0

I'll be replying via your blog, but you've stated some items that are just
plain false:
- we do have command line options
- we do have multiple conversion approaches (project, solution, folder,
file, snippet, asp.net file & snippet)
- we do have a help file (included with the demo)

We didn't receive your email (perhaps blocked by our email filter?). You
shouldn't be making false claims about our product just because an email was
not answered/received. This is the first time I've heard of a review of
Instant C# based purely on the demo edition. Most authors would either
ensure that we are contacted for a full copy of the software or omit the
review.
--
http://www.tangiblesoftwaresol...
C++ to C#
C++ to VB
C++ to Java
VB & C# to Java
Java to VB & C#
Instant C#: VB to C#
Instant VB: C# to VB
Instant C++: VB, C#, or Java to C++/CLI


"Cowboy (Gregory A. Beamer)" wrote:

> Consider VB Conversions. You can read my review and competitive analysis
> (with requisite disclaimer that one was a full version and another a demo):
> http://gregorybeamer.spaces.live.co...!B036196EAF9B34A8!786.entry
>
> --
> Gregory A. Beamer
> MVP, MCP: +I, SE, SD, DBA
>
> Subscribe to my blog
> http://feeds.feedburner.com/Greg...
>
> or just read it:
> http://feeds.feedburner.com/Gre...
>
> ********************************************
> | Think outside the box! |
> ********************************************
> "Stephen" <stephenwo@gmail.com> wrote in message
> news:c5760f3e-8004-42e2-8627-a97992c2d34a@w1g2000prk.googlegroups.com...
> >I have a large VB6 code base that I need to convert to C#. I am
> > assuming that the best approach would be to first convert it to VB.NET
> > and get it into a compilable state, then to convert it to C# from
> > VB.NET.
> >
> > Problem: I see a lot of converters out there that do a pretty good
> > job of performing the conversion. But most of the ones I see do this
> > on a file by file basis rather than a project by project basis.
> >
> > So: what's the best converter out there that will take a VB.NET
> > project as input and produce a C# project with converted code as
> > output?
> >
> > Thanks,
> >
> > Stephen
>
>

Alex Clark

8/21/2008 6:58:00 PM

0

Personally I wouldn't even consider it.

Anything written in VB6 would likely benefit hugely from a rewrite rather
than a code-gen conversion. You'll be able to refactor your code to take
advantage of the enormous language enhancements that have been made over the
years, and VB6 wasn't even truly an OO language, so there'll be plenty of
extra functionality to exploit from the compiler there. I don't think
there's any quick fix for what you want, no matter how good the converters
are today.


"Stephen" <stephenwo@gmail.com> wrote in message
news:c5760f3e-8004-42e2-8627-a97992c2d34a@w1g2000prk.googlegroups.com...
>I have a large VB6 code base that I need to convert to C#. I am
> assuming that the best approach would be to first convert it to VB.NET
> and get it into a compilable state, then to convert it to C# from
> VB.NET.
>
> Problem: I see a lot of converters out there that do a pretty good
> job of performing the conversion. But most of the ones I see do this
> on a file by file basis rather than a project by project basis.
>
> So: what's the best converter out there that will take a VB.NET
> project as input and produce a C# project with converted code as
> output?
>
> Thanks,
>
> Stephen


Alvin Bruney [ASP.NET MVP]

8/22/2008 12:13:00 AM

0

small shops? that approach is ok. Large institutions can easily run up a
multi million dollar tab for a rewrite of a critical LOB. An automated port
is significantly cheaper and is a low hanging fruit that stake holders will
more easily head for.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Download OWC Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $15.00
Need a free copy of VSTS 2008 w/ MSDN Premium?
http://msmvps.com/blogs/alvin/De...
-------------------------------------------------------


"Alex Clark" <quanta@noemail.noemail> wrote in message
news:eqKym$7AJHA.5316@TK2MSFTNGP04.phx.gbl...
> Personally I wouldn't even consider it.
>
> Anything written in VB6 would likely benefit hugely from a rewrite rather
> than a code-gen conversion. You'll be able to refactor your code to take
> advantage of the enormous language enhancements that have been made over
> the years, and VB6 wasn't even truly an OO language, so there'll be plenty
> of extra functionality to exploit from the compiler there. I don't think
> there's any quick fix for what you want, no matter how good the converters
> are today.
>
>
> "Stephen" <stephenwo@gmail.com> wrote in message
> news:c5760f3e-8004-42e2-8627-a97992c2d34a@w1g2000prk.googlegroups.com...
>>I have a large VB6 code base that I need to convert to C#. I am
>> assuming that the best approach would be to first convert it to VB.NET
>> and get it into a compilable state, then to convert it to C# from
>> VB.NET.
>>
>> Problem: I see a lot of converters out there that do a pretty good
>> job of performing the conversion. But most of the ones I see do this
>> on a file by file basis rather than a project by project basis.
>>
>> So: what's the best converter out there that will take a VB.NET
>> project as input and produce a C# project with converted code as
>> output?
>>
>> Thanks,
>>
>> Stephen
>
>

Alvin Bruney [ASP.NET MVP]

8/22/2008 12:13:00 AM

0

So you're saying the review is no good? :-)

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Download OWC Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $15.00
Need a free copy of VSTS 2008 w/ MSDN Premium?
http://msmvps.com/blogs/alvin/De...
-------------------------------------------------------


"David Anton" <DavidAnton@discussions.microsoft.com> wrote in message
news:F29745E3-03AB-4677-BB1D-17F771D52001@microsoft.com...
> I'll be replying via your blog, but you've stated some items that are just
> plain false:
> - we do have command line options
> - we do have multiple conversion approaches (project, solution, folder,
> file, snippet, asp.net file & snippet)
> - we do have a help file (included with the demo)
>
> We didn't receive your email (perhaps blocked by our email filter?). You
> shouldn't be making false claims about our product just because an email
> was
> not answered/received. This is the first time I've heard of a review of
> Instant C# based purely on the demo edition. Most authors would either
> ensure that we are contacted for a full copy of the software or omit the
> review.
> --
> http://www.tangiblesoftwaresol...
> C++ to C#
> C++ to VB
> C++ to Java
> VB & C# to Java
> Java to VB & C#
> Instant C#: VB to C#
> Instant VB: C# to VB
> Instant C++: VB, C#, or Java to C++/CLI
>
>
> "Cowboy (Gregory A. Beamer)" wrote:
>
>> Consider VB Conversions. You can read my review and competitive analysis
>> (with requisite disclaimer that one was a full version and another a
>> demo):
>> http://gregorybeamer.spaces.live.co...!B036196EAF9B34A8!786.entry
>>
>> --
>> Gregory A. Beamer
>> MVP, MCP: +I, SE, SD, DBA
>>
>> Subscribe to my blog
>> http://feeds.feedburner.com/Greg...
>>
>> or just read it:
>> http://feeds.feedburner.com/Gre...
>>
>> ********************************************
>> | Think outside the box! |
>> ********************************************
>> "Stephen" <stephenwo@gmail.com> wrote in message
>> news:c5760f3e-8004-42e2-8627-a97992c2d34a@w1g2000prk.googlegroups.com...
>> >I have a large VB6 code base that I need to convert to C#. I am
>> > assuming that the best approach would be to first convert it to VB.NET
>> > and get it into a compilable state, then to convert it to C# from
>> > VB.NET.
>> >
>> > Problem: I see a lot of converters out there that do a pretty good
>> > job of performing the conversion. But most of the ones I see do this
>> > on a file by file basis rather than a project by project basis.
>> >
>> > So: what's the best converter out there that will take a VB.NET
>> > project as input and produce a C# project with converted code as
>> > output?
>> >
>> > Thanks,
>> >
>> > Stephen
>>
>>

David Anton

8/22/2008 12:27:00 AM

0

A bad review I can take - we're happy to accept and fix the two bugs he
pointed out.

However, blatently false information is not acceptable (we *do* have a help
file, we *do* have command line features, we *do* have many conversion
approaches beyond mere folder or snippet conversion).
--
http://www.tangiblesoftwaresol...
C++ to C#
C++ to VB
C++ to Java
VB & C# to Java
Java to VB & C#
Instant C#: VB to C#
Instant VB: C# to VB
Instant C++: VB, C#, or Java to C++/CLI


"Alvin Bruney [ASP.NET MVP]" wrote:

> So you're saying the review is no good? :-)
>
> --
>
> Regards,
> Alvin Bruney [MVP ASP.NET]
>
> [Shameless Author plug]
> Download OWC Black Book, 2nd Edition
> Exclusively on www.lulu.com/owc $15.00
> Need a free copy of VSTS 2008 w/ MSDN Premium?
> http://msmvps.com/blogs/alvin/De...
> -------------------------------------------------------
>
>
> "David Anton" <DavidAnton@discussions.microsoft.com> wrote in message
> news:F29745E3-03AB-4677-BB1D-17F771D52001@microsoft.com...
> > I'll be replying via your blog, but you've stated some items that are just
> > plain false:
> > - we do have command line options
> > - we do have multiple conversion approaches (project, solution, folder,
> > file, snippet, asp.net file & snippet)
> > - we do have a help file (included with the demo)
> >
> > We didn't receive your email (perhaps blocked by our email filter?). You
> > shouldn't be making false claims about our product just because an email
> > was
> > not answered/received. This is the first time I've heard of a review of
> > Instant C# based purely on the demo edition. Most authors would either
> > ensure that we are contacted for a full copy of the software or omit the
> > review.
> > --
> > http://www.tangiblesoftwaresol...
> > C++ to C#
> > C++ to VB
> > C++ to Java
> > VB & C# to Java
> > Java to VB & C#
> > Instant C#: VB to C#
> > Instant VB: C# to VB
> > Instant C++: VB, C#, or Java to C++/CLI
> >
> >
> > "Cowboy (Gregory A. Beamer)" wrote:
> >
> >> Consider VB Conversions. You can read my review and competitive analysis
> >> (with requisite disclaimer that one was a full version and another a
> >> demo):
> >> http://gregorybeamer.spaces.live.co...!B036196EAF9B34A8!786.entry
> >>
> >> --
> >> Gregory A. Beamer
> >> MVP, MCP: +I, SE, SD, DBA
> >>
> >> Subscribe to my blog
> >> http://feeds.feedburner.com/Greg...
> >>
> >> or just read it:
> >> http://feeds.feedburner.com/Gre...
> >>
> >> ********************************************
> >> | Think outside the box! |
> >> ********************************************
> >> "Stephen" <stephenwo@gmail.com> wrote in message
> >> news:c5760f3e-8004-42e2-8627-a97992c2d34a@w1g2000prk.googlegroups.com...
> >> >I have a large VB6 code base that I need to convert to C#. I am
> >> > assuming that the best approach would be to first convert it to VB.NET
> >> > and get it into a compilable state, then to convert it to C# from
> >> > VB.NET.
> >> >
> >> > Problem: I see a lot of converters out there that do a pretty good
> >> > job of performing the conversion. But most of the ones I see do this
> >> > on a file by file basis rather than a project by project basis.
> >> >
> >> > So: what's the best converter out there that will take a VB.NET
> >> > project as input and produce a C# project with converted code as
> >> > output?
> >> >
> >> > Thanks,
> >> >
> >> > Stephen
> >>
> >>