- Shopping Bag ( 0 items )
Ships from: Chatham, NJ
Usually ships in 1-2 business days
Ships from: Honolulu, HI
Usually ships in 1-2 business days
The Microsoft Visual Basic 6.0 Learning Edition on CD-ROM
Learn Visual Basic Now, the popular CD-based interactive program for hands-on learning
Visual Basic 6.0 Step by Step, Learning Edition, the acclaimed book that provides clear modular lessons you can complete at your own pace
Visual Basic Programmer's Guide, a rich reference for everything from programming fundamentals to optimizing and distributing applications
The MSDN Developer's Library CD
Visual Basic, Now you can learn how to program for Microsoft Windows the easy way. Get ""Microsoft Visual Basic 6.0 Deluxe Learning Edition"".
This bundled self-paced training kit consists of two printed manuals and two CD-ROMs. The manuals are Microsoft Visual Basic 6.0 Programmer's Guide and Microsoft Visual Basic 6.0 Step by Step. Only the programmer's guide is also sold separately. The two CD-ROMs offer complete training in multimedia form and also include the MSDN Library. The CD-ROMs are not sold separately. To derive the most benefit from this publication, students should be familiar with general programming concepts and Windows 95 through on the job experience or from other publications or training courses.
If you've read "Working with Objects" in Chapter 5, "Programming Fundamentals," you know that an object variable declared As New contains Nothing until the first time you refer to it in code. When you use the variable for the first time, Visual Basic notices that it contains the special value Nothing, and creates an instance of the class. (And a good thing it does, too, or f . Show would cause an error.)
You may be wondering how it is that you can refer to Form1 in code, as if it were an object variable. There's no magic involved. Visual Basic creates a hidden global object variable for every form class. It's as if Visual Basic had added the following declaration to your project:
When you select Form1. as your startup object, or type Form1. Show in code, you're referring to this hidden global object variable. Because it's declared As New, an instance of the Form1 class is created the first time you use this predeclared variable in code.
The reason this declaration is hidden is that Visual Basic changes it every time you change the Name property of a form. In this way, the hidden variable always has the same name as the form class.
Which of the instances of Form1 you created in the exercise above was associated with the hidden global variable? If you guessed the first one, you're right. Form1 is the default startup object for the project, and to Visual Basic that's just like using the predeclared global variable Form1 in code.
In Chapter 5, "Programming Fundamentals," you learned that to refer to an object, you need an object variable, and that an object exists only as long as there's at least one object variable containing a reference to it. So what was keeping all those other instances alive?
The second instance of Form1, and all the ones that followed, had an object variable for just as long as it took to call their Show methods. Then that variable went out of scope, and was set to Nothing. But Visual Basic keeps a special collection named Forms, which you can read about in "More About Forms" in Chapter 6, "Creating a User Interface." The Forms collection contains a reference to each of the loaded forms in your project, so that you can always find and control them.
Note: As you'll learn, this is not true of all classes. For example, the classes you design won't have hidden global variables or global collections to keep track of them - those are special features of form classes. However, you can declare your own global variables, and you can create your own collections - as described in "Creating Your Own Collection Classes," later in this chapter.
Properties, Methods, and Events of Form Classes
The first time you added a property to a form class, you probably did it visually, by dropping a command button (or some other control) on Form1. In doing so, you added a read-only Command1 property to the form class. Thereafter, you invoked this property of Form1 whenever you needed to call a method or property of the command button:
Command1.Caption - "Click Me"
When you changed the Name property of any control on a form, Visual Basic quietly changed the name of the read-only property, so they always matched.
If you still have the project open from the earlier exercise, you can see this Command1 property by pressing F2 to open the Object Browser. In the Project/Library box, select Project1. You'll see Forml in the Classes pane. In the Members pane, scroll down until you find Command1, and select it.
Command1 has a property symbol beside it, and if you look in the description pane, you'll see that it's a WithEvents property. As you'll learn in "Adding Events to a Class," later in this chapter, this means that the property (or object variable) has event procedures associated with it. One of those event procedures, Command1_Click( ) may have been the first place you ever wrote Visual Basic code.
But Wait, There's More
Dropping controls on a form is not the only way to add new members to the form class. You can add your own custom properties, methods, and events, as easily as you create new variables and procedures.
To see this, add the following code to the Declarations section of Form1:
' The Comment property of the Forml class.
Public Comment As String
Add the following code to the Click event of Form I:
Private Sub Form_Click( )
MsgBox Comment, , "My comment is:"
Finally, change the code in the Command1_Click( ) event procedure by adding a line, as follows:
Press F5 to run the project. Click Command1, and when the input box appears, type in some racy comment and click OK. When the new instance of Form1 appears, click on it to play back its Comment property.
Click on the first instance of Form1, and notice that its Comment property is blank. Because Visual Basic created this instance as the Startup Object, you never got a chance to set its Comment property.
Forms Can Call Each Other's Methods
If you were watching closely, you may have noticed that the code you added to the Forml class didn't set the object's own Comment property - it set the Comment property of the new instance of Form1 it was creating.
This ability of forms to set each other's properties and call each other's methods is a very useful technique. For example, when an MDIForrn is opening a new child window, it can initialize the new window by setting its properties and calling its methods.
You can also use this technique to pass information between forms.
Other Kinds of Modules
You add properties, methods, and events to form classes by putting code in their code modules. In the same way, you can add properties, methods, and events to class modules and - if you have the Professional or Enterprise Edition of Visual Basic - to UserControl and UserDocument code modules.
As you read "Adding Properties and Methods to a Class" and "Adding Events to a Class," later in this chapter, remember that everything you read applies to form classes as well as to class modules.
For More Information What the heck is a class module? "Class Module Step by Step," on the next page, shows how to define a class and illustrates the life cycle of the objects you create from that class. . . .
Posted July 18, 2001
If you are considering enbarking into the journy of computer programing then visual basic 6.0 learning eddition is for you. It's everything you need to start developing fast paced windows applications. Whith great step by step tutorials...Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted January 28, 2001
This is great for learning. Bill Gates has done it again. This lets you make EXE files and lets you make txt database files to store data in. It also lets you us the install wizard to make a program that will either run from a cd or install from a cd to the users computer. If you are thinking of embarking on the Visual Basic language the I recommend this 110%. Don't think with fear. Go for it. You will not be disappointed......Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted September 5, 2000
I bought this set at Walden's for list price, and I was horribly disappointed. For that amount of money, I expected a scholastic approach with lots of complete step-by-step application exercises. WRONG!!!Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted December 25, 1999
This package is great for beginners and the Step by Step book is great! I only beef was that I felt cheated because I expected the Visual Basic 6.0 Step by Step book to be the same as the Visual Basic Professional 6.0 Step by Step which is sold separately. Instead it has only 14 Chapters instead of 24 Chapters if you buy the book separate! That means No Rich Text Control (can't word process without this!), Multimedia, Internet apps, Windows API and lots more!Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.