8

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.

MPelletier
  • 15,673
  • 14
  • 84
  • 131
sakthivignesh
  • 119
  • 1
  • 2
  • 9
  • what makes you ask such a wide question? And, answer it as well? – shahkalpesh Sep 01 '09 at 16:48
  • 8
    Nothing wrong with answering you own questions. It's actually encouraged. You just want to be ***sure*** you have a very good answer when you do so, and that you leave a chance for the community to also provide input. It's also good etiquette on SO to make your _answer_ (not the question) community wiki. – Joel Coehoorn Sep 01 '09 at 16:51
  • 4
    @sakthivignesh: i think you caught a lot of flack for this by writing such a vague question *and then immediately posting a very inadequate answer to it*. In the future, you'll want to avoid this unless, as Joel notes, you *know* you have a good answer. Instead, spend more time writing a good question... – Shog9 Sep 02 '09 at 16:23

6 Answers6

10

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.

kemiller2002
  • 110,913
  • 27
  • 192
  • 245
7

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
  • 506,650
  • 124
  • 909
  • 1,183
  • I would say that "they are completely similar languages" where "similar" is equivalent to "different" - like apples and pears! – andora Nov 22 '11 at 12:40
5

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.

In the same way, you can't contrast "Pespi" and cola, because Pepsi is a cola, but you can contrast Pepsi and Coke.

That said, the VB.Net dialect of VB brings a significant number of changes and improvements to the language, including true support for object oriented and functional paradigms, to the point where idiomatic VB.Net code is often very different from VB6-era code.

Joel Coehoorn
  • 380,066
  • 110
  • 546
  • 781
  • 3
    Having used both, I must disagree. – Kawa Sep 01 '09 at 16:50
  • 2
    No it's not. Though both are dialects of Basic, but with different compilers and somewhat similar syntax. – Svante Svenson Sep 01 '09 at 16:51
  • 3
    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 Sep 01 '09 at 16:54
  • 1
    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 Sep 01 '09 at 16:57
  • 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.) – Svante Svenson Sep 01 '09 at 16:59
  • @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 String End Property – Svante Svenson Sep 01 '09 at 17:04
  • 3
    @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 Sep 01 '09 at 17:06
  • 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 Sep 01 '09 at 17:14
  • @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... – Svante Svenson Sep 01 '09 at 17:17
  • 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 Sep 01 '09 at 17:22
  • 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. – Svante Svenson Sep 01 '09 at 17:27
  • 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 Sep 01 '09 at 17:41
  • @Kibbee: VB.NET actually contains two significantly-different languages, depending upon whether code is compiled with "option strict on" or "option strict off". The language implemented with "option strict off" is close enough to the old VB language to allow a lot of code to be ported, but from a language-design standpoint it's horrible. Even with "option strict on" there are some bad kludges in the language, but it's far less like the old VB. – supercat May 17 '13 at 22:38
2

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
  • 7,783
  • 1
  • 21
  • 28
1

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

VB is the old version.

Shiraz Bhaiji
  • 62,289
  • 31
  • 137
  • 240
1

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.

Svante Svenson
  • 12,209
  • 4
  • 40
  • 45
  • 2
    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 Sep 05 '09 at 19:54