Darwinbots Forum

Code center => Darwinbots3 => Topic started by: Botsareus on April 20, 2009, 05:26:28 PM

Title: Converting C# into vb.net
Post by: Botsareus on April 20, 2009, 05:26:28 PM
Can you fully translate c# into vb.net or is there some systems that can't be translated?
Title: Converting C# into vb.net
Post by: Prsn828 on April 20, 2009, 05:38:58 PM
Quote from: Botsareus
Can you fully translate c# into vb.net or is there some systems that can't be translated?

Umm, why would you ever want to do that?

Honestly, I really don't think so, but if you allow "goto" statements then I am inclined to believe it might be possible.

Really though, what would possess a person to convert C# into VB.NET?
Perhaps you meant VB6 to VB.NET
If that is the case, the answer remains the same, except without all the "what are you thinking!?" statements
Title: Converting C# into vb.net
Post by: Shasta on April 20, 2009, 06:21:48 PM
VB.NET to C# (http://www.developerfusion.com/tools/convert/vb-to-csharp/)
That worked for me the other day when someone sent me something in VB.NET and I wanted to have it in a more comfortable form. No idea how it works on the project scale. It should work however as C# and VB.NET both run on the CLR (As long as there is no "unsafe" code in the C# project)
Title: Converting C# into vb.net
Post by: Botsareus on April 20, 2009, 08:10:31 PM
Quote
Really though, what would possess a person to convert C# into VB.NET?

I am a vb junky, that is, it's the first programing language I ever learned and I am very comfortable in it.
Title: Converting C# into vb.net
Post by: Numsgil on April 20, 2009, 09:27:42 PM
C# and VB.NET both get compiled into something called CIL.  See clicky (http://en.wikipedia.org/wiki/Common_Language_Runtime).  So there are a few programs floating about which can convert between the various .NET languages.

That said, Bots, seriously it's been years.  It isn't that hard to learn another programming language.  It is going to be uncomfortable at first.  It's sort of like learning to walk all over again.  But it's always worth the effort.
Title: Converting C# into vb.net
Post by: Moonfisher on April 22, 2009, 03:27:40 AM
Also VB.net looks a lot more like Java and C than it looks like VB6.
Generaly it seems to me like all the .NET languages except Visual C++ look like the same blend of Java and C...
And Visual C++ is just C++, except the compiler comes up with what I like to call fake warnings, telling you to use Visual studio specific functions instead of using the STL libraries (Which is breaking the standard and IMO not something one should recommend, especialy when it means you won't be able to build with a regular C++ compiler.)

Also IMO VB6 is a bit confusing to learn... like for instance I was wasting time figuring out that a While is terminated by Wend, which goes against the syntax they had established that far (EndIf, EndFor, WEnd... ?)

Generaly most higher level programming languages look more or less the same, and knowing one language usualy means it'll be easy to learn a second one and even easyer to learn the third one.
And it should be very easy to pick up C#, if you use the visual studio frontend then it'll highlight errors and give you some relatively clear compiler warnings, you can tab for auto completion (Good way to discover a new syntax realy fast without using a browser).
Other than that there should be some good web pages out there covering the syntax.

There may be some new concepts to pick up along the way, but most of what you know about VB6 is true for the other high level languages. So picking up new languages when you know one of the sort realy shouldn't be a problem (The hard part is learning how to learn programming, and since you already did that you're past the hard part)
And you'll spend just as long learning VB.NET as you would C# I bet...
Title: Converting C# into vb.net
Post by: Botsareus on April 22, 2009, 11:20:48 AM
Quote
It isn't that hard to learn another programming language

 :)  That is exactly why I asked about the accurasy of the convirsion tools. I want to learn c#. The best way I see is to plug c# into one of these tools and see how it looks it in vb.net...

I am catching on I think:

Quote
IF (a == B)
{
a++;
}

vb:

Quote
If a = b then a = a + 1

Ok, now I will see if I got it right:

C#
Quote
if (a == B) {
    a++;
}

aha, I forgot that c# is case sensitive...
Title: Converting C# into vb.net
Post by: Prsn828 on April 22, 2009, 01:25:57 PM
Good job there

Actually, it shouldn't be that hard, just read the different symbols you see in C# as words you associate with in VB6.

Also, Nums and I are always happy to help.  I know that C# is so powerful that it is at first very overwhelming, but once you get past the learning curve it is easy to pick up the rest.  Also, since VB is more basic in syntax, most anything you write in VB translates nicely into C#; it is going the other direction that is difficult.
Title: Converting C# into vb.net
Post by: Numsgil on April 22, 2009, 07:55:57 PM
Yeah, there are some nasty things you can do in C/C++/C#/Java that don't translate well to VB