views:

501

answers:

6

I'm reasonably familiar with the various forms of VB that existed prior to .NET (VB6, VBA, VBScript...), but have yet to delve into The Sweet New Flavor that is VB.NET.

So I would very much appreciate it if someone would provide a quick summary of the major differences in the language brought about by VB.NET.

+8  A: 

Assuming when you say vb you mean vb 6. Pretty big. The original visual basic does not use the .net runtime environment, and although they have similar names, they are pretty much too different languages. Visual Basic is not fully object oriented, but VB.net is. Error handling is vastly different between the two. VB.Net has try catch blocks where traditional vb uses On Error GOTO statements. These are just a few differences. The list goes on and on.

Here is a link describing the "Visual Fred" Name.

Kevin
Let's not forget the nickname "Visual Fred".
Kawa
OMG I totally forgot about that name.
Kevin
VB.Net still supports On Error GOTO statements for backwards compatibility reasons.
Kibbee
Joel's answer is better, VB.NET is STILL visual basic ;-)
Meta-Knight
yeah, he's right that it is still vb. I was going on the assumption that when he said vb vs vb.net, he was referring to vb 6, as that is what people commonly refer to when they say vb.
Kevin
+2  A: 

There are quite a few - too many to list I think. You could almost consider VB.Net a completely different language that shares some similar syntax to VB. The biggest change is becoming familiar with the .NET classes.

TLiebe
+4  A: 

VB.Net is just the version of Visual Basic intended to work with the .Net framework. It also makes other changes and additions to the language, but contrasting VB.Net with VB is not possible, because they are the same thing.

What you can do is contrast with VB.Net with VBA, or VB6, or VBScript, or some other variant of Visual Basic. But VB.Net still IS one possible variant of VB. In fact, if you look at the language part of the product by itself, they're now calling the latest version VB9, with VB10 due out later this year.

Joel Coehoorn
Having used both, I must disagree.
Kawa
No it's not. Though both are dialects of Basic, but with different compilers and somewhat similar syntax.
svinto
VB.Net is one flavor of VB. It's not the only flavor, certainly, but to believe it's not VB because it's not the same as another specific variant of VB you may have used is just ignorance.
Joel Coehoorn
This is very much true. The compiler is basically the same with some extra features added for object inheritance, and other features that have been added. The syntax is exactly the same, with a few new keywords thrown in to support the new features. Now the .Net API that is supported for VB.Net makes it a much better language to work with, but that doesn't mean that it's not the same core language underneath. If you create a VB.Net console application, even in VS.Net 2008, it still starts you off with a module, like in the old VB, no classes necessary.
Kibbee
This argument seems to boil down to on how we look at things; I see VBScript, VB, VB.net and Quick Basic/VBDOS as different dialects of basic. I see VB 1-6 as different versions where you could use code from a previous version without changing it in a newer version. (With the exception 16-bit to 32-bit with third party.)
svinto
@Kibbee: Oh really? Then why doesn't this valid VB6 code compile in whatever version is in Visual Studio 2008?Public Property Get Test() As StringEnd Property
svinto
@svinto: VB6 is _one variety_ of Visual Basic, but it is _not_ the end-all-be-all of visual basic. You can contrast VB.Net with VB6. You cannot contrast VB.Net with VB, just like you cannot contrast VB6 with VB.
Joel Coehoorn
Same reason that all the from C++99 compile in the new c++0x, and the same reason that some code form Java 1.1 won't compile in Java 6. As new language features are added, some syntax has to be changed which will enable new features, but break old code.
Kibbee
@joel: Yes I can, and I'm pretty sure most VB 1-code works in VB6, but probably not in VB.net. Please don't make me go through old boxes to find that VB (1) floppy to prove my point...
svinto
If you think there weren't _any_ breaking changes introduced between vb1 and vb6, you're sadly mistaken. Visual Basic is a _bigger_ concept than VB1-6.
Joel Coehoorn
Sure some changes but not as major as this one, at least not if you went through all versions.Yes it is, though I include all variants of Basic from Microsoft in that project, including GW BASIC, VBScript, VBA, VB and VB.net.
svinto
The only thing that makes VB.Net more of a major change than the advancement from any other version of VB 1 through VB 6 is the addition of the .Net runtime. However, the .Net runtime is not a change to the language, just an addition of libraries and APIs. So while VB.Net code may in general look a lot different from VB6, due to the fact that you are programming against a different API, the actual language syntax itself didn't change that much. If VB.Net was meant to be a new language, and not just a new version of an old language, they would have got rid of "On Error Goto" which they didn't.
Kibbee
+1  A: 

VB.Net is a newer version that uses the Dot Net Framework / managed code.

VB is the old version.

Shiraz Bhaiji
+1  A: 

VB compiles to p-code or native code, VB.net compiles to MSIL. Also the syntax differs a bit. As VB.net is the upgrade path for VB users and programs, there are a bunch of helper objects and functions that makes moving code from VB to VB.net easier, these objects and functions aren't normally used in programs written in other .net languages.

svinto
VB5 and VB6 can be compiled to native machine code. P-code was used in earlier versions of VB (but was still optional VB5 and VB6).
Konrad Rudolph
+2  A: 

Oh the horror.

Sorry, but all existing answers are wrong in some way or another. Joel’s is actually the best of the bunch but its poor wording encourages misunderstanding (sorry, Joel – but just look at your comments!):

contrasting VB.Net with VB is not possible, because they are the same thing.

That’s exactly like saying that “contrasting apples with fruits is not possible because they are the same thing,” and as such not very helpful; especially since many people (still) use “VB” synonymously with “VB6.”

So, to clear things up a bit: both VB6 and VB.NET are dialects of the Visual Basic language family (let’s call it that). Their resemblance is superficial at best; someone who has actually used them both (and not only looked at some source codes) will have noticed that apart from a cursory syntactic similarity, they are completely different beasts. Using them are fundamentally different experiences.

The only aspect in which they actually resemble each other (apart from said syntax similarity) is that they both are very well suited for rapid application development (RAD) … at least until you’ve tried dynamic languages such as Python or Ruby in combination with GUI agile frameworks such as Shoes. But even as RAD environments go there’s a huge difference.

VB6 was basically developed to do RAD, nothing else. And in its time, VB6 was the best thing on the marked to do RAD, by a large margin. VB.NET, on the other hand, was not singled out for RAD development – any more than C#. Both are high-end languages backed by a general-purpose framework, much like Java but with the aspiration to improve on some of Java’s faults, such as its over verboseness by cutting a lot of boilerplate code (introduction of delegates, events, properties, operator overloading, autoboxing to name but a few such features).

And while VB.NET is to a large degree backwards compatible, this is very misleading. First off, no sane person would say that C and C++ are the same languages just because a lot of C programs compile fine on C++ compilers. The differences between VB and VB.NET are even bigger by some metrics because no complete VB6 code is valid VB.NET. It needs an automated “upgrade assistant” to produce valid .NET code, and experience has shown that this upgrade assistant is unsuitable even for medium-sized projects, mainly because its literal translation breaks many guidelines and assumptions of the .NET world.

Saying, like Kibbee, that the compilers of VB6 and VB.NET are “basically the same” is flat out wrong. Likewise, claiming that “the .Net runtime is not a change to the language” misses the point completely. Of course it’s a change in the language. VB.NET was completely build around the .NET framework, it’s not just any other library.

He claims that

If VB.Net was meant to be a new language, and not just a new version of an old language, they would have got rid of "On Error Goto" which they didn't.

– which is likewise misleading. “On Error Goto” was included solely for backwards compatibility (the upgrade assistant cannot convert old-style error handling into exception-based error handling).

Let me sum up the main point of this rather long posting so it doesn’t get lost: Just like Java and JavaScript, VB6 and VB.NET have very similar names (and for very much the same reason, too: marketing) but this is entirely misleading. There are a few syntactic similarities. Apart from that, superficially as well as under the hood, they are completely different languages.

Konrad Rudolph