Visual Basic Guide to Upgrading a Guru.

2005

Page 1

    What's Good About it.

  

First let's talk about stand alone. As a regular product VB '05 has no Stand alone product, at least not one you can buy. We've stepped back even further from VB6 Pro (I was told this exists) to a standard VB product, to well, an Express. The first thing that comes to my mind is Outlook Express. This old standby is handy for the casual windows user who likes to be on the internet. With it packaged in with Internet Explorer it will satisfy a lot of people and save them from finding some other e-mail client. In much the same vein VB Express is for the casual programmer. Meant also to be a learning edition for students alike. But is it worth getting at all? Hell yea it is, especially if your budget can't keep up with MS's product version distribution plan! Download it here, it's Free!

So what's good about it? It's free. And I'll be tarred and Feathered, it has that missing Class Library Template I was so pissed about not having in the stand alone products. You might even get away with just using the express product to get by with for your next few projects or so, as long as your demand doesn't get into ASP.Net and Mobile (Actually we here at Wizard Randus need both of those things.) But since I haven't even expressed anything about them in my lessons it's definitely not necessary for you to participate in following me along in any new lessons I come up with. Hopefully more than the sum total of 2002 & 2003.

It's okay, I approve, you can now be a happy camper! I was, too, for a while. Let's see what else is good. Standard install of both the framework 2.0 & VBE'05 went smooth as silk. I almost felt as if I were about to wake!

Yes, we've been allowed to write code, run it and just play around without ever saving anything. Of' course these files exist in a temp folder somewhere, but we don't care about that as long as we can jump in, test some code and jump back out. Then again we could get caught up well into a project, forget to save and have a crash, but are we not used to that yet? So don't forget to save when appropriate or change your settings to save every time you compile & debug (Easist)

How To: In the Main IDE Click tools ---> options. Check show all. Projects & Solutions --->Build & Run.

More Options! Oh yea, there were lots in the last two as well, but now we have some we want. And best of all they are all in the same general area, either under project properties or just double click My project. Under Application's side tab you'll see a button for Assembly info, an easy type into form window for you to change these settings.

Next up you may notice on a nice new application project that the code window for form1 is empty! Yes, it's not cluttered with so much as a collapsed region. So what does it mean? Well the point is of' course to re-enliven the VB experience as we remember as far back as VB 6. In fact if you haven't taken full notice, VB (Visual Basic) is no longer VB Dot Net. It's just VB again. So we are having a difficult decision in deciding what to call it, VB '05 or VB 8. Hmmm. Either may apply and I may switch between the two. So back to our form's designer code, is it gone? Has it been left up to the compiler? If anyone had ever taken a look, our VB 6 form had a form file. It had a dot frm extension to it. When VB 6 loaded it, it gave us only our code in the code editor, the rest, looking like this:

VERSION 5.00
Begin VB.Form frmKeyGen
Caption = "Generate Key"
ClientHeight = 1140
ClientLeft = 60
ClientTop = 450
ClientWidth = 4950
Icon = "frmHack.frx":0000
LinkTopic = "Form1"
ScaleHeight = 1140
ScaleWidth = 4950
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdFindWind
Caption = "Get Window"
Height = 375
Left = 3600
TabIndex = 4
Top = 600
Width = 1215
End
Begin VB.CommandButton cmdRecall
Caption = "Recall"
Height = 375
Left = 1320
TabIndex = 3
Top = 600
Width = 975
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 2
Left = 1920
Top = 600
End
Begin VB.CommandButton cmdPreset
Caption = "Test"
Height = 375
Left = 240
TabIndex = 2
Top = 600
Width = 975
End
Begin VB.CommandButton cndGen
Caption = "GenKey"
Height = 375
Left = 2400
TabIndex = 1
Top = 600
Width = 1095
End
Begin VB.TextBox tbGen
Height = 375
Left = 240
TabIndex = 0
Top = 120
Width = 4575
End
End
Attribute VB_Name = "frmKeyGen"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Was not shown and only used to generate the form in the designer window. So now we have that back. And this is generally good, because when editing the designer code, it often got messed up when the designer reread it and eliminated certain elements that we may have added. This is a much stronger message not to toy with MS's code generation. So where the hell did it go?

Welcome to Partial class files. the IDE has gotten smarter...or has it just remembered what it had forgotten? We have to give credit where credit is due, VB 6 was in it's 6th generation and VB 7 & 7.1 were only in the first two. That's a lot of work to recreate VB as it was while still making a whole new environment to work with. It's okay, you can say thanks.

Is the partial class file useful to me? Maybe, depending on how much code your single class may have you can break it up into partial files. I still don't see it, where is it, really? It really is just another file in your project folder, but much like other things in the solution's explorer it's not being shown. Also missing are the references and the AssemblyInfo.vb file. At least that one can be found under the project's options. And the partial class? Click the nifty show all button in the solution explorer. Hey there are my references and the designer code file is under your form1 file, as if it were contained within it liken to a folder. Kind of confusing. And if you expand My project, you get all the files containing the info about your project that shows up under properties. the point being, you need not handle these files directly, The IDE handles them for you. So go ahead and click the show all button again and they will all go back into hiding.

Okay so I have a project, but where's my solution? What's happening here is another express feature. There is no need for a Solution for a single project. But for how long is that going to be happiness for project folder structures? Well, let's see. Let's start our first project. Click New project and politely discard the current one. Now for a name type RoadTest. Now click open file and look at the list of folders in your project's folder. If your just getting started, you won't have any, either way you won't see your project saved. Depending on whether or not you adapted to the previous versions of VB Dot Net, you may want to go back to saving first, back out of this dialog.

How To: Go back into tools---> Options---> Projects & Solutions ---> General and check Save new Project's when created.

Then we want to save, click save all. Hey! There's the solution name, happens to be the same as the project name. Sounds familiar yes? At this point Change it too Test Solution and save. Now when you look at the top of the IDE you get the solution name, as it is different than the project. Without knowing it, you could be automatically creating both the solution and the project with the same name. Now when you click open file it has moved you to your project folder, which is within a solution folder. Incase you didn't notice, there was an option to uncheck to not make the solutions folder. Options are Value Added! Now add a second project to your current solution and see what happens. RoadTest2 works for me. Ahh there's my solutions indicator in the solutions explorer. But wouldn't it be nice, especially since it's so much a part of what we learned so far to always see the solution? Look at the above How To and check always show the solution. Or not, if you prefer.

Now click New Project. Click OK. If you changed your setting you will see the solution with the same name as the project. If your sure your project isn't going to expand, you can save it without a solution folder. This puts your whole project folder under the My projects folder along side the the solutions folder we just made and any you already have. And low and behold you still have a solution's file. Now add a second project and see what happens. Make sure you give it a unique name like WindowsApplication2. Now you have two project folders under My projects. The first one contains the solution file and the second does not, it's not related to the solution all on its own, if you open 2, that's all you get, if you open 1 you get the entire solution. Closing Project 2 will ask you if you want to create a solution for it, or save it as it may be. Now go back to our road test. It doesn't matter which project you open, they both open the entire solution they belong to. You definitely want to keep all this in mind as you wander along with me in shadows and dark places that tend to make us think, maybe the nightmare isn't over?

There are more goodies to this new version. Smarter Intellisence, auto code generation off code errors, and more controls to boot. But let's move on.

Page 2