Visual Basic 6.0

Started by
6 comments, last by Michalson 17 years ago
I'm going to be brushing up on my VB this weekend, but I have a dilemma. The version I want to have a solid understanding of is 6.0. I have a copy of 4.0 from way back in the day when I first learned the language, and I also downloaded the 2005 EE free version. Which version is most like 6.0? I'm going to want to integrate VB with Excel spreadsheets. Also, does anyone have any good links for this type of thing? Specifically that deal with Excel & VB, but really any good VB sites?
Advertisement
If you want to learn VB6, you need VB6. VB.NET (versions 7.x and 8) is nothing at all like classic VB. VB4 is nothing at all like VB6.

The important question, of course, is why you want to learn VB6 in particular - it's a severely outdated toolkit and more modern and superior alternatives are readily available (including the free VB2005 which you already have). Modern versions of Excel should include their own VBA version which you can use directly; they should also support interop with the .Net languages if you want external control.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

A good question here is what you really want information on:

Using a stand alone exe (made in Visual Basic 6) to load/save/interact with Excel, or add Visual Basic [for applications] code (known as VBA) to an Excel spreadsheet or template file. Coding wise they are very similar to each other, except that one has the relationship to Excel embedded.

If it's VBA, then you just need a copy of Excel. More specifically, during the Office install process, select custom and browse down the tree until you find the VBA entry, which includes an option for including the VBA help file.

If it's stand alone Visual Basic 6, you'll need a copy of 6 (VB.NET is totally different), and you'll want to look up Excel Automation on the MSDN reference library (or post some specific questions, as I've used the Excel Automation interface from Delphi and VBA code [Access] so I could help you out).

Getting Visual Basic 6 will be a challenge (it is almost 10 years old now). You will either need to buy a used copy (which leaves you open to getting ripped off with a non-working burned CD from a guy in the former Soviet bloc - the one reviewer on Amazon claims he was sent VB4 instead of the advertised version 6) or download it legitimately from Microsoft via an MSDN subscription. MSDN Premium gives you Visual Basic 6 Enterprise Edition (2 CD ISOs and a licence key, 1.04GB), but I don't know if MSDN Professional (or other lesser editions) do. Looking at the comparison page it isn't listed at all (though there are a lot of things on MSDN that aren't...like the fact that QuickBasic Pro is actually available for download), making me think it probably is in Professional given that it doesn't seem important enough to list in the comparison.

Is this for a specific job?

Edit: Oh, and there is one luck based method for getting a copy of VB6 to learn from: Visual Basic 6 Learning Edition, which was included with a bunch of Visual Basic 6 books back in the day on the included CD. If you know of any discount computer book places (the places that have stacks of horribly outdated computer books being sold off for 10% of their original sticker price) you could dig around for one (just make sure the CD is still attached). Keep in mind you can't distribute stuff made with Learning Edition, so if you need a VB6 compiler for actual work, you'll be back where you started.
The reason for my wanting to learn 6.0 specifically is because its for work, i'm going to be helping out with a project that has aspects of it coded in VB 6. Updating everything to the newest version is out of the question at the moment.

I already have a pretty good working knowledge of VB syntax, so I guess I'll just brush up with 2005 and assume that since VB is pretty easy, I'll be able to decipher the differences in the 6.0 code when I see it.

Thanks for the replies!
Do be aware that VB.NET is so vastly different from VB6 that the VB developer community got all riled up about it (don't know why... I was used to VB4 when I switched to .NET - after stumbling a few times, I realised it was a far nicer language). Google for "Visual Fred" or "VB.NOT".

I'm pretty dubious as to just how portable the knowledge is - although aspects of the syntax are the same, they are genuinely very different. Just some words of caution. :-)
[TheUnbeliever]
Quote:Original post by Funkymunky
The reason for my wanting to learn 6.0 specifically is because its for work, i'm going to be helping out with a project that has aspects of it coded in VB 6. Updating everything to the newest version is out of the question at the moment.

I already have a pretty good working knowledge of VB syntax, so I guess I'll just brush up with 2005 and assume that since VB is pretty easy, I'll be able to decipher the differences in the 6.0 code when I see it.

Thanks for the replies!


To be honest I would advice against this approach (unless you want to learn and use VB.NET seperate from this VB6 project). Simply put, the real things beside the basic BASIC syntax of VB6 that you need to learn to work well in the language are all the gotcha aspects of the language: like how calling a function varies depending on if you are recording the result (one requires you to enclose the parameters in brackets, the other expects you to not enclose them), or how the regular INTEGER type is 16bit signed, not 32bit signed, or how the "standard" library varies wildly between arrays/collections being zero based or starting at 1, or that sub/function parameters are references by default. And this is before you start finding out fun stuff related to Visual Basic variants (and the fact that even if you declare variables types the data still often get mangled by the VB variant code) or all the "runtime" errors that coming from any other language on the planet you'd think would have been caught by the compiler (just be grateful that it will usually catch an unterminated IF statement, rather then crash at runtime when it hits that code).

The VB.NET syntax really only has a passing resemblance to VB6: almost all the oddities have been removed, the .NET standard library replaces most of the VB library and controls, and the compiler is no longer retarded. So really, as a not beginner programmer who is just switching to another language (VB6), the real things you need to know to work well in VB6 have been totally removed in VB.NET.
VB4 is very much like VB6 except for one crucial difference: implementation. That will be your biggest stumbling point. It took me a while to grasp the usefulness of implementation, because inheritance is so much more powerful all around. VB5/6's implementation of implementation (excuse the pun) is annoying at best. One time, while randomly browsing MSDN, I accidentally discovered what "rhs" actually means, and then I forgot.

Using .NET as a basis for learning VB6 is a terrible idea. The VB/VBA run-time may have been the spiritual basis for .NET, but it's come a long way since 1999. Your best source for info is probably Planet Source Code. Not only is their classic VB code base fantastically huge, but it's still updated regularly. If you can think of it, you can probably find an implementation there. Use that as a starting point.

GDNet+. It's only $5 a month. You know you want it.

If worse comes to worse, just open Office (I'd recommend Access but if not Excel is second best) and play around with VBA, which is far, far closer to VB6 then .NET (in particular it has almost all the same gotchas). With Access you could actually create a form, drop on some buttons, and have something pretty close to using VB6 without actually doing anything with the Access database functionality.

This topic is closed to new replies.

Advertisement