VB.NET will be big business.
You may not realise it now, but by the end of this year it’s likely to be the hottest buzzword around. Erm, if it isn’t already. As I type, industry magazines are crying out for anyone to write on the topic. I’ve personally had three offers so far this week.
And they don’t even care if you know what you’re talking about. The prerequisites? The ability to use the word “VB.NET” in every other sentence, know something about Visual Basic (any version) and be relatively familiar with the English language. And those last two are optional.
But why is there so much hype? Well, VB.NET is the next version of Visual Basic — and it brings with it a huge wad of changes.
We’re not talking about a couple of controls here and there. A new keyword, a little extra functionality. Ohhh no. We’re talking about a change so drastic, it’s the biggest move Visual Basic has seen since… well, since it’s birth back on my birthday in 1991.
Now wouldn’t it be nice to learn about this new tool before the final version hits the market?
That’s what this six-part series is here for. In just six laid-back weeks, I’ll teach you all the VB.NET essentials. And I’ll be speaking in plain English — no techie jargon this side of the Atlantic, thank ya very much.
But there’s a lot to cover and time is running out. So brace yourself, coders as we prepare to face a new dawn in the history of programming.
At least, that’s what the press release said.
There’s so much hype surrounding this VB.NET thing that it’s sometimes difficult to figure out what it actually is. Hmm, good question.
Maybe it’s simpler to just tell you what VB.NET isn’t. It isn’t a Web site. It isn’t so drastically different that you’ll need to relearn everything you already know about VB (just most of it). And it isn’t a lycra-wearing toad.
OK, maybe it isn’t simpler telling you what it isn’t. But if you are looking for a quick description, well… it’s the next version of Visual Basic.
The End. Well, perhaps not.
You see, this next version is just one part of what Microsoft are calling the ‘.NET strategy’ — essentially a grand plan guaranteed to bring big changes to the software world. And big changes to the bank balance of Billy-Boy Gates.
One key component of this plan is the revamping of its major programming languages. This means a new version of Visual Basic plus a completely new language called C# (pronounced C-Sharp after Microsoft decided C-Hash sounded a little too dubious).
But how is this next version different to any other upgrade? After all, the change from Visual Basic 5 to Visual Basic 6 didn’t rouse quite so much interest!
Hmm, true. However VB .NET — also known by its lesser-cool name, Visual Basic 7 — is built on something called the ‘.NET Framework’, one part of that .NET strategy I was rambling on about.
Now this .NET Framework essentially sits on top of the operating system. And it handles everything from memory management to rendering a user interface.
When you program in VB.NET, you’re dealing with this framework thing. And that framework thing brings with it a bunch of ‘classes’ that provide you with a heap of functionality from a function to reverse a string through to procedures that really take you to the heart of the operating system, perhaps procedures that had never before been available to VB developers.
In addition, the framework allows you to forget about memory management and related rubbish. It’s incredibly scalable and even brings an end to the infamous ‘DLL Hell’ by getting rid of GUIDs, registration and all that jazz — it’s difficult to imagine at first, but the framework handles all of this automatically.
It’s the framework that allows you to create in VB .NET everything from DOS-style console applications through to Web sites — in just the same way as you would any regular desktop application!
But what is this framework? Is it a program? Is it an operating system? What?
Well, I stumbled over that very same question. And it’s actually all of those things. It’s an ‘upgrade’ if you like — an add-on to Windows. It’s incredibly useful and it will soon be bundled by default with every Microsoft operating system. In the meantime, you’ll find it on the Windows Component Update CD that ships with VB.NET Beta One.
Top Tip: Remember— you need the .NET Framework before you can run any program created in a .NET language. Just a warning.
OK, so in brief – VB.NET is the next version of Visual Basic, scheduled for release later this year. It is tightly coupled with the .NET Framework, a cool ‘functionality layer’ that sits on top of the operating system.
So how do you slap this new version of Visual Basic onto your machine? Well thankfully it’s a relatively simple, if not slightly buggy process.
Your best bet is to grab one of the many copies of Visual Studio.NET Beta One currently floating around. This comprises of one Windows Update CD and the core Visual Studio.NET application.
If you can’t find yourself a copy, head down to msdn.microsoft.com/vstudio/nextgen/beta.asp
First off, a couple of notes — at present, you cannot create .NET applications on a Windows 95 machine. You can however zap it onto Windows 98, Windows ME, Windows NT4, Windows 2000 Server or Windows 2000 Professional.
Top Tip: Even though you can’t create .NET applications in Windows 95, you can run them so long as you’ve installed the framework.
If you’re running Windows 2000 or Windows NT, make sure you have Internet Information Server installed before starting the setup. Do the ‘Add/Remove Programs’ thing if you need to add it. If you don’t, you’ll not be able to access all of the groovy Web Form features we’ll be looking at later.
Top Tip: If possible, install VB.NET Beta One on a machine that isn’t being used for anything else. Remember, conflicts and problems are possible, so back up all important files!
So, you’re ready to install? Great!
First off, you need to run the Windows Component Update, which installs essentials such as the .NET Framework I was boring you about earlier. To do this, insert the first disc of Visual Studio.NET setup. A screen should popup a little similar to this:
The only option here is to install the Windows Component Update. Click the hyperlink and you’ll be prompted to insert the third disc. Simply follow the wizard through and hope for the best.
Note that when I installed this pack on my machine, it failed thrice with the ‘Year 2000 Update’ (now you tell me?). Remember that this is a beta tutorial about a beta product installed by a beta setup program. It’s all a little trial-and-error at present, so keep at it — and don’t worry if the install ain’t perfect.
After a little whirring and the occasional reboot, you’ll be presented with a congratulations screen that confirms all the required components have been installed:
Next, it’s on to actually installing Visual Studio.NET.
Slap the first CD back into your drive. That same menu will crop up once again, this time bearing a second option, ‘Install Visual Studio.NET’. The rest is simple.
Click the hyperlink and follow through the wizard. If possible go with the full install to avoid problems (and trust me, I’ve found a couple in this department).
On my machine, the install crashed approximately five times. Thankfully I have the patience of an angel and more free time than Bill Gates’ fashion consultant. So just keep smiling 😉
Now, when the Visual Studio.NET setup finishes, it’s time to open the champagne and shout ‘hurrah and hujjah!’ (or words to that effect) — you’ve passed the first stage. Visual Studio.NET has been successfully installed on your machine.
This is where the fun begins… <groan>
So you’ve installed VB.NET, huh? Excellent!
In this short section, we’ll briefly explore the new Visual Basic development environment, plus create a mini ‘Hello World’ program.
First off, fire up Visual Basic.NET:
- Click Start, Programs, Microsoft Visual Studio.NET 7.0, Microsoft Visual Studio.NET 7.0
After a little whirring — ok, a lot of whirring — you’ll be presented with a ‘Start’ page.
Top Tip: Beta One of Visual Studio.NET has been in no way optimised. This essentially means it’s incredibly slow. Just grin and bear it. Or send hate mail to Bill Gates. Choice is yours.
Now this is your ‘Profile’ page. It allows you to tell Visual Studio what sort of a person you are. In future, it’s rumoured you’ll be able to enter your name, age, sex (a boolean field) and favourite hobbies — and will automatically be matched up with matching geeks and geekesses from around the globe.
Erm, but for now you can just tell it what sort of developer you are and what sort of keyboard layout you have. How exciting.
Click the groovy ‘Profile’ combo box and select ‘Visual Basic Developer’
This tells the development environment that you are used to VB, so enjoy seeing a Properties window and pressing F5 to start your application. Etcetera.
- Hit the ‘Get Started’ link at the bottom of the page
So, let’s create a new project:
- Select the ‘Create New Project’ link
This will present you with a list of possible project types.
Top Tip: Notice how you can also create Visual C++, Visual C# and Visual FoxPro projects from this dialog? All of these tools use the one singular development environment there’s no longer a separate program for each language. You can even debug programs created in two separate languages together using this one interface!
Now, quickly take a peek at all those options in the ‘Templates’ window. The ‘Windows Application’ is what you used to call a Standard EXE. The ‘Class Library’ is essentially an ActiveX DLL/EXE.
Moving on and the ‘Windows Control Library’ allows you to effectively create ActiveX controls. This is similar to the ‘Web Control Library’, which allows you to create an ActiveX control that can be used on a Web site, though is spewed out in HTML code and requires no extra downloads.
Playing on the Web theme, you’ll also see a ‘Web Application’, which essentially allows you to build a fully HTML-based Web site as you would a regular Visual Basic application — no extra knowledge required. You’ll also find a ‘Web Service’ option there, which is effectively DCOM on a longer wire. We’ll look at both of these in more detail later in this series.
The ‘Windows Service’ allows you to create a service for Windows (D’OH!) — something that was previously incredibly difficult without slipping Dan Appleman a huge wad of cash. And finally, ‘Console Application’ lets you create your own DOS-style text display/input application with ease — also something that was very difficult in VB6 unless you followed the console tutorial here on VB-World (link).
Now some VB .NET whizz kids will probably get annoyed with me comparing a .NET ‘Windows Control Library’ project with an VB6 ‘ActiveX Control’ project. They are very different, but the core concept is still the same. And we’ll be exploring many of these new types in greater detail later in this series.
- Select ‘Windows Application’
- Change the Name and Location (ahem, if you get the urge)
- Click OK
Let’s explore the new development environment…
So you’ve created a new Windows Application project, huh?
Now, I’ll be the first to admit the development environment does look a little different from those halcyonic days of Visual Basic 6. But if you take a few minutes to study it, you’ll notice it’s actually pretty much the same.
To the left of the screen, you have the Toolbox, full of controls. You’ll notice a few favourites in there: the Label control, the TextBox, the PictureBox. And a few have been renamed, such as the Radio Button (formerly Option Button), GroupBox (aka Frame) and of course, Button (of Command Button fame).
You’ll also spot a whole load of new controls there. We’ll look at these in more detail later — but they’re actually not as scary as they first appear! 😉
To the right of your screen, you have the Properties window, which doubles up as a Help facility. Plus, just above that you’ll find what was previously the ‘Project Explorer’. This keeps a track of all the files and references within your app.
And finally, in the centre of your screen you’ll find Form1 ahhh, just like ol’ VB6.
So, let’s do something!
- Add a Button to Form1, just as you would in VB6
- Double-click on the Button
Arghhhh! What’s all that code?
You’ve just double-clicked on the Button and a whole load of pre-written code has popped up. Where? Who? Why? Well, it’s essentially code that tells the form how to build itself, but ignore it for now.
Your cursor should be flashing between:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) End Sub
Now, this is similar to our old Command1_Click() sub, though a perhaps a little more complex.
Type in the following code:
MessageBox.Show("Hello World!", "My First App")
Top Tip: As you type this code out, notice that Visual Basic doesn’t change the casing automatically! So if you type ‘MESSAGEBOX’, it won’t automatically convert it to the proper casing of ‘MessageBox’. I don’t like this feature and hope they switch casing back on in Beta Two.
Another Top Tip: Whilst the MsgBox statement still exists, MessageBox.Show is the next hip and trendy way to display one of ’em.
- Press F5 to test your code
After a little more whirring your form should popup.
- Click the Button to display your Message Box
Your form should look something like this:
And that’s it! Hurrah and congratulations on creating your first VB.NET application!
We’ll be looking in more detail at ‘Windows Forms’ and VB.NET code in the next instalment, but for today, it’s time to wrap up.
In Getting Started, we found out exactly what VB.NET is, plus figured out how to slap it onto our machine. Finally, we explored the new Visual Basic development environment, plus created a mini test program.
Over the next month, we’ll be bringing you even more VB.NET Uncovered tutorials to keep you ahead of the crowd. Let’s review what’s coming up:
- Big Changes — A look at the all-new ‘Windows Forms’ plus those fresh wizzy controls, along with a geek-peek at all those VB.NET coding changes
- Working the Web — Figure out how to create your own dynamic, interactive, personalised Web sites in the time it’d take you to knock up a desktop application
- Services Rendered — A quick look at Web Services and how they blast DCOM out of the skies
- Doing Data — ADO.NET. So, what’s all that about then? A sneak-peek at working with databases in the next version of Visual Basic
- They’re Objects, Jim — But not as we know them! With VB.NET, we get a fully object-oriented programming language. Yet what does it really mean to developers?
You know, every day I receive hundreds of mail messages. Half of these ask why Microsoft has removed the line control in VB.NET, why the code syntax has changed, why WebClasses have disappeared. The other half ask why it took so long.
It’s a big change, no doubt about it. But from my own workings with the language, it’s a change for the good. So better to embrace the new technologies before anyone else, than be left behind on a backburner.
That’s the conclusion — and so until the next time, this is Karl Moore asking that you take care of yourselves. Annnd each other. Goodnight!