Click Here!
home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
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!
(Publisher: The Coriolis Group)
Author(s): Peter G. Aitken
ISBN: 1576102815
Publication Date: 08/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


Part 2
Sharing Data And Code

Chapter 6
Component Madness

Visual Basic makes use of components of all shapes, sizes, and types.

Components are at the heart of Visual Basic program-ming. Not only do you use components in just about anything you do with Visual Basic, but you can also create your own components for use by you and others. This is the first of several chapters devoted to components. For you to be a good Visual Basic programmer, you must have a good understanding of what components are available to use in your projects, as well as the various types of components you can create using Visual Basic. First, however, we need to take a look at the different kinds of projects that Visual Basic can create.

Visual Basic’s Project Types

By now, you’ve probably noticed the various Visual Basic project types available in Visual Basic’s New Project dialog box. Up until now, we have used only the Standard EXE type; in fact, for most Visual Basic programmers, this is the type used most often. But what are these other project types? How do they differ, and what are they used for?

The following list gives a brief description of the project types offered in the New Project dialog box. You will not have all of these types available to you unless you are running the Enterprise Edition of Visual Basic. If a project type is covered in this book, the relevant chapter is referenced at the end of the description. No, I don’t cover all of the project types. Some of them are simply beyond the scope and space limitations of this book.

  Standard EXE—A “regular” Windows application. A Standard EXE program can use ActiveX components but does not expose any components of its own. A Standard EXE can define objects for its own internal use (Chapters 2, 5).
  ActiveX EXE—A “regular” Windows application that also exposes one or more ActiveX objects for use by other programs. Microsoft Word is an example of an ActiveX EXE (although it was not created with Visual Basic). It is an executable program that defines ActiveX objects that are used internally and also exposed for use by other programs (Chapter 8).
  ActiveX DLL—A dynamic link library that exposes ActiveX objects for use by other programs but has no functionality of its own (Chapter 8).
  ActiveX Control—An ActiveX object with a visual interface that can be “plugged” into other programs. Some of Visual Basic’s controls are ActiveX controls (Chapter 17).
  ActiveX Document EXE—A method of packaging a Visual Basic program so that the program’s forms and code can be accessed from within a “container” application, such as Microsoft Internet Explorer. It’s most often used in Web publishing.
  ActiveX Document DLL—A dynamic link library containing code that supports an ActiveX Document EXE.
  Application Wizard—Not a project type per se, but rather a “helper” that assists you in putting together the framework of a Standard EXE project (Chapter 5).
  Addin—A component that is tied into the Visual Basic development environment to enhance its functionality. Use this project type to create your own add-in.
  DHTML Application—A group of related Hypertext Markup Language (HTML) pages that work together, with help from Visual Basic code, to fulfill a task. DHTML applications are “executed” in a Web browser, such as Microsoft Internet Explorer.
  Data Project—A database project that is created to contain two specialized designers for database related programming tasks.
  IIS Application—An application that runs on a Web server to accept, process, and respond to information requests.
  Enterprise Edition Controls—A project that automatically loads all the special Enterprise Edition controls into the Toolbox (as if you had selected them individually in the Components dialog box).

I don’t expect you to understand all of these project types yet, but it’s a good idea for you to have this introduction now.

Making Components Available In Visual Basic

A typical Windows system will have dozens, if not hundreds, of software components available on it. You may be wondering where all these components came from, but it is no mystery—it’s just the way Windows and Windows programs work. Most application programs use components themselves; often, these components are exposed, or made available, to other programs. For example, if you have the Microsoft Excel spreadsheet installed on your system, it exposes the Chart, Equation, and Worksheet objects. Likewise, the Adobe Photoshop program exposes the Image object. This is in addition to all of the objects, including controls, that come as a part of Visual Basic. All of these objects are potentially available for you to use in your Visual Basic project.

Why do I say potentially? If all of these objects were immediately available to you—in the Toolbox, for example—the Visual Basic development environment would get awfully confusing. Instead, only the intrinsic controls are always available, and you must specifically select other objects to be available in Visual Basic. The available objects fall into two general categories: components and references.


TIP:  Objects And The Registry

How does Visual Basic (or any other program, for that matter) know which objects are available? The answer lies in the Windows registry. When a new component or a program that exposes objects is installed on a system, information about the objects is put in the registry. Other programs, such as Visual Basic, can retrieve this information to determine which objects are available.


Components

The term component may be difficult to define precisely, but for the present discussion, we can say simply that a component is anything you access via Visual Basic’s Components command. To see what I mean, select Components from the Project menu and press Ctrl+T to display the Components dialog box (Figure 6.1).


Figure 6.1  The Components dialog box has three tabs.


Previous Table of Contents Next


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.