![]() |
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
![]() |
To access the contents, click the chapter and section titles.
Visual Basic 6 Programming Blue Book: The Most Complete, Hands-On Resource for Writing Programs with Microsoft Visual Basic 6!
Note that this dialog box has three tabs, corresponding to the following three types of components:
ReferencesThe other way to make software components available in Visual Basic is with the References command on the Project menu. When you select this command, the References dialog box is displayed (Figure 6.2). Selected references, marked with a check, are grouped at the top of the list. Other available references are listed alphabetically below. What exactly is a reference? To answer that question, I need to explain the concept of a Type Library. When an object is exposed for use by other applications, it is usually necessary to know the details of the objectits methods, properties, and so onto make use of it. A Type Library contains this information in a standard format. By selecting a reference in the References dialog box, you are, in effect, telling Visual Basic, Take note of the object information in this Type Library. You would select a reference in this dialog box for two primary reasons: to make the object information available in Visual Basics Object Browser, and to enable early binding for object references in your programs. Both of these topics will be covered in more detail in Chapter 10.
Three of the entries in the References list are always selected, and you are not permitted to unselect them: Visual Basic for Applications, Visual Basic Runtime Objects and Procedures, and Visual Basic Objects and Procedures. These three sets of references are the foundation of Visual Basic itself, so they must always be available. Visual Basic will usually not let you unselect any references that are used in the current project. I say usually, because in some cases, an object is referenced in a project in a way that Visual Basic does not know about it until the program is executed or compiled. In these situations you are not prevented from unselecting the associated reference in the References list, but you will receive an error message when you try to run or compile the program. You can, however, have references selected that are not used in the current project. This should be avoided, because when Visual Basic resolves a reference, it looks through all of the available (checked) Type Libraries. Having unneeded references selected will slow down the program compilation process. Note the Priority buttons in the References dialog box. You use these buttons to move the highlighted reference up or down in the list. When Visual Basic comes across a reference to an object in code, it searches the available Type Libraries in the order they are listed in the References list. In the unlikely event that two or more objects have the same name, Visual Basic will use the one it finds first. Creating And Using ClassesOne of the ways that Visual Basic lets you implement software components is by means of classes. A class provides both data storage and code self-contained in a reusable module. When properly designed, a class isolates you, the programmer, from all of its inner workings. You can simply use it without worrying about what is going on inside. Once you have created a class, you can reuse it in any and all of your Visual Basic projects. You implement a class in Visual Basic by means of a class module. The type of class were talking about now cannot present a visual interface to the userit is code and data only. Other types of Visual Basic classes do provide a visual interface, and we will get to them in subsequent chapters.
|
![]() |
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |