vb to c# converter

B

bptree

If anyone wants a tool to convert vb .cls and .bas files to c# classes,
please let me know.

thanks.
 
W

William Ryan eMVP

BPtree, I've seen a few, one was at ragingsmurf .net and I believe Kamal
Patel still has this one available
http://www.ellkay.com/ConvertVB2CSharp.htm . However, if you want
something really cool, check out Ankarino which decompiles everythign to IL
and then it can recreate it and does this by default in C#. VB.NET supports
a lot of stuff (crap depending on your perspective) that C# doesn't like
optional parameters that give most converters a fit. So in VB.NET, if you
have a function with an optional parameter, you effectively have two
functions, you can call it with no params, or with one parameter. However
in C# you only have one function which takes one parameter (I don't mean
this in the literal sense that you have two functions but I don't want to
get into the nuances here).

There's also a lot of potential problems with the converters if you coded
your vb.net stuff with option strict off and didn't strongly type it. So if
you want your conversions to work, turn on option strict, get rid of all of
the old vb legacy stuff and do everything the .NET way. If you do, all of
the major converters should work pretty well.

HTH,

Bill
 
J

Jimi

I've been using Instant C# (www.instantcsharp.com) for a few weeks and
it's very good - no problem with optional parameters or anything like
that. I'm actually surprised at the success rate I achieve with it.

I also looked at going the decompiler route, but you'll lose comments
and formatting - maybe not the wisest move. Also, decompilers will
lose the intutiive logic flow - IL is constructed to run efficiently,
not read efficiently.
 
J

Jimi

I wouldn't trust any tool going straight from VB6 to C#.

Use the upgrade wizard to get to VB.NET (and a few hours of tweaking),
and then use something like Instant C# (and a little more tweaking).
 
W

William Ryan eMVP

Not that I know of, but you can upgrade your VB6 app to VB.NET via the
upgrade wizard and then convert it over. If you are coming from vb6, then
the conversion to .NET is the issue, the language is trivial. You'll
probably have a lot of chnages to make to get a VB6 app to convert to .NET
depending on how it was coded, but once you have it in vB.NET changing it is
pretty straightforward.
 
J

Jimi

A translater is a good tool, but if you learn C# its better!
Of course you need to learn C#, but if you're like me and had a
hundred thousand lines of VB.NET code (formerly VB6 code), then
you're talking major carpal tunnel syndrome without a converter.
 

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