Partager via


Visual Basic Concepts

General Principles of Component Design

This chapter and "Debugging, Testing, and Deploying Components" contain those topics that apply to all types of ActiveX components. These chapters provide necessary background for the in-depth treatment of component types in subsequent chapters.

This chapter begins with "Component Basics," a group of topics that explain key terminology and concepts of component design.

The rest of the topics in "General Principles of Component Design" and "Debugging, Testing, and Deploying Components" are organized according to the general sequence of development tasks for components:

  1. Determine the features your component will provide.

  2. Determine what objects are required to divide the functionality of the component in a logical fashion.

    See "Adding Classes to Components."

  3. Design any forms your component will display.

  4. Design the interface — that is, the properties, methods, and events — for each class provided by your component.

    See "Adding Properties and Methods to Classes," "Adding Events to Classes," "Providing Named Constants for Your Component," "Providing Polymorphism by Implementing Interfaces," and "Organizing Objects: The Object Model."

    The remainder of the task-oriented topics are contained in "Debugging, Testing, and Deploying Components." In addition to the following development tasks, they cover distribution, version compatibility, and creating international versions of your component.

  5. Create the component project and test project.

  6. Implement the forms required by your component.

  7. Implement the interface of each class, provide browser strings for interface members, and add links to Help topics.

  8. As you add each interface element or feature, add code to your test project to exercise the new functionality.

  9. Compile your component and test it with all potential target applications.

Topics

Component Basics

Component creation terminology and concepts; the limitations of component project types; startup and shutdown rules.

Adding Classes to Components

Class module basics for components, including instancing models, default properties, and robustness.

Adding Properties and Methods to Classes

Interface How To’s, including deciding whether a member is a property or method, private communication using Friend methods, and allowable data types.

Adding Events to Classes

Declaring, raising, and handling events in classes provided by your component.

Providing Named Constants for Your Component

How to add named constants to your component’s type library.

Private Communications Between Your Objects

The objects provided by your component may need to exchange information or perform actions you don’t want to expose to users of your component.

Providing Polymorphism by Implementing Interfaces

When several objects implement the same interface, client applications can gain improved performance through polymorphism.

Organizing Objects: The Object Model

Make it easier for people to use your component by providing relationships between the objects your component provides. Further implications of Instancing.