• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 349
  • Last Modified:

What is the difference between VB6 and VB.net?

Please be specific as to advantages/disadvantages and comment on the learning curve to jump to .net.  Thanks!
1 Solution
Well.. VB.NET requires the .Net Framework which is about 20 megs, so if it is not to be used in a controled environment, you might want to stay for VB6 for now since only Windows XP is shipped with .NET framework included.

if that is not a problem, VB.NET is type safe, meaning that you can no longer declare variable as variant type and assign them any value, resulting in a faster application and less error-prone.

Every single thing in VB.NET is an object, yeah, even an integer is an object. So as for the learning curve, if you have never done object oriented programming, you may consider a couple of full time weeks before being confident with that type of programming. But Object Oriented programming is good anyway.. you'll save in the long run with the code-reuse and the maintability of your application (much easier).

It also use try/catch statement to handle error.. not as easy as the on error goto but still not too hard to get familiar with.

VB.NET also has the advantage of being able to produce multi thread application :-) As well as ASP.NET/XML Webservice with SOAP.

So if you got some time to learn it, I would say it is best to go with it since this is the near futur :)
but if your time is limited,.. stay with VB6.

Hope this help a little bit :)
VB6 advantages:
* Lots of resources available (components and personnel)
* Relatively easy to use

VB6 disadvantages:
* Soon to be obsolete
* Promotes error-ridden code if not coded properly

VB.Net advantages
* Uses the latest, greatest tools
* Integrates well with other .net tools

VB.Net disadvantages
* Requires more resources to operate
* Steeper learning curve because it does not tolerate bad coding as well as VB6

Probably much more, but this is the "overview" answer.
I would say that upgrading to VB .Net is the way to go.  You can use VB6 and VB .Net on the same machine.

You can even use COM components created in VB6 in a VB .Net application.

The problem with VB has always been how COM is implemented.  How many frustrating hours have you spent using MS Transaction Server dealing with dll files, and having to reboot the server whenever you have to make changes to the code?

VB .Net has inheritance, which is quite useful and easy to implement.

The data types have changed in .Net.  For example, the VB6 Long is now Integer, and Integer now uses an In16 and Int32.  Long is now 64 bits.

The String data type is now used like many other languages, in that whenever you concatenate new data to a String variable, VB destroys the instance of the variabel and creates a new variable with the extra data.  This creates a lot of overhead if you're doing a lot of string manipulations.

VB .Net now has a StringBuilder object that is easy to use, and allows you to Append data to the string, without destroying and recreating the object every time.

All things .Net come from the System object, which speaks directly with the CLR (Common Language Runtime).

Another beauty of .Net is that you no longer have to worry if you grabbed all your application's components while making an install file.  It's all there already within the .Net Framework, so now you can concentrate on what the installation should look like instead of worrying about dependency information.

A lot of the old stuff is still there, for example, they left the On Error Goto errHandle type error handling, even though they're pushing you to learn the new Try, Catch, Finally type of error handling.  I think the new way is better, and MS has threatened to remove the GoTo in some future version.

Also, any variables you declare within a block, like a For..Next or Do..While, dies then the block is done.  You can still declare variables before the block and use them inside, but it is a noticable change in scope.

.Net was written specifically for C#(which, SSSHHHH, is really Java, but don't tell anyone.  lol), and MS figured that if they were going to add VB they might as well rewrite it and do it write.

All the .Net languages are geared for ASP .Net.  ASP .Net is actually how I envisioned ASP shoudl always be.  You still have your html and can do scripting, but now you also have a Code-Behind form, which allows you to do anything in VB for the web form!

All the Web Form objects, whether HTML objects or Web Form objects, render automatically to whatever browser you're using.  This is nice!

.Net also uses a lot of XML, but don't worry if you don't know XML.  In .Net you only need to understand the very basics to get started.  You should never have to actually manually write an XML document, because .Net has objects that do that for you.

You can load an XML document into the IDE, whihc has a built-in browser to view the tags and data, or you can right-click and choose to view the XML document as a datasource table!  Here you can change data types, etc. as if you're using MS Access or MS SQL Server.  Sweet!

Not all of your applications have to be upgraded to VB .Net from VB6.  It depends on what you want to do.

I love .Net so far, but I'm not uninstalling my VB6 just yet either.

I believe .Net was a necessary step that MS has to make.  

I hope this helps a little.
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

>RichW: "VB destroys the instance of the variabel and creates a new variable with the extra data.  This creates a lot of overhead if you're doing a lot of string manipulations."

Wow!  That sounds like some upgrades are going to take major performance hits.  And I hear that upgrades can take as long as two years to convert.  Maybe this is part of the reason.

>now you can concentrate on what the installation should look like instead of worrying about dependency information

I assume that means you only have to worry about YOUR OWN dependency files, since obviously .net will not know about those.  For example, if I have a reference to an external image or file, I still need to tell the install about it.
So far as images, yes.  I was mainly referring to VB dependency information.  For example, when you use the FileSystemObject in VB6, you must add the dependency file for the FileSystemObject.

Now, all objects are on the machine that has the .Net Framework installed.

Any old COM objects you run in .Net and place on a server different from the development server, yes, ou must make sure you grab those files.

The upgrade for strings objects won't be that difficult.  If you have strings that keep the value, there is no need to upgrade to a StringBuilder object.

There are also a lot of neat little things that make life a little easier in the IDE.  For example, the Task List now shows you comments like 'TODO.  'TODO is a default, there's also 'HACK.  You can even make up your own.  Every one of these comments in your code will show up in the Task List where you can double click on it to take you to the code.

You can also create macros in th IDE to perform certain functions.

Help now brings yo to the MS Knowledge Base web site with the built-in browser.

Another nice thing is if you are running a dll file on a web server for an ASP .Net application, you no longer need to stop the application to add an upgraded version of the dll.  You just drop it in, and users who are already in the application will continue to use the old version until they begin a new session, and any new users who enter the application will automatically use the new version of the dll.  This is a dramatic improvement over the old ways.

Microsoft is going to continue to support VB6, but they're already threatening to move to .Net, because they don't know how long they're going to support it.

The Upgrade Wizard does a decent enough job.  Of course, all samples from Microsoft upgrade without a hitch.  lol

There are some objects that will not upgrade.  If .Net doesn't understand what a control should be it defaults it to a Label object.

The Upgrade Wizard also places comments in areas where you need to upgrade the code for certain objects.

Old On Error Goto statements will not be upgraded to the Try Catch Finally, because it's still supported.

Again, if your users are happy with a VB6 application, and there's no need to take advantage of the .Net platform, then there's no reason to upgrade.

I think all new development should be done in .Net if you have it.

I found that the move to .Net wasn't that difficult from VB6.  I thought it was going to be harder than it really was/is.

I think this major release is just the beginning of some really powerful releases to come.
ACorvaiaAuthor Commented:
Thanks Rich, that is alot of help.  I am fairly familiar with VB6, can you recommend a VB.net book that will get me up to speed quickly?
Thanks, ACorvaia.  Dan Appleman has a book Moving from VB6 to VB .Net.

Another suggestion would be The ASP .Net Complete Reference.  Even though it's a book on ASP .Net, all the examples are for VB and C#, which are really geared for ASP .Net anyway.

I also bought the VB .Net Programmer's Reference, but I get a programmer's reference book for anything I'm using.

Also, you can go to http://www.gotdotnet.com.  It's a Microsoft site that uses Passport technology with tons of articles and samples of .Net code and techniques.

Visual Sudio .Net Magazine is also another good reference, and the subscription is cheap enough.

Thanks again, and good luck!
There's one other thing I forgot.  There are no longer default properties for form controls.  For example, if you wanted a value from a textbox named txtFirstName in VB6 you didn't have to request the .Text property, because it was the default property of a Textbox control.

Now, you have to say txtFirstName.Text or you'll get an exception error.  This was necessary for object orientation.

Also, they got rid of the .Caption property for controls liek the Label control.  It's now .Text.  They did this for uniformity.  You get used to it real quick.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now