A class is a unit of reusable code. So is a component. To author a component, you start with a class. What is the difference, then?
A class becomes a component when it conforms to a standard for component interaction. This standard is provided through the IComponent interface. Any class that implements the IComponent interface is a component. For details about interfaces, see Polymorphism in Components. Such standards allow developers to plug components together quickly to create larger programs. The common language specification (CLS) describes the way components authored for the common language runtime can interact. For details, see What Is the Common Language Specification?
The .NET Framework provides the IComponent interface and the Component base class to make it easy to author components that work well in the design environment, and UserControl and Control classes that make it easy to author visual components.
In This Section
- Component Class Characteristics
- Introduces class attributes and what they mean for a component class.
- Initialization and Termination of Components
- Explains where to write the code to initialize your component, dispose of system resources, and destroy your component.
- Component Instancing and Constructors
- Describes controlling the way your components are created, by setting the appropriate access on their constructors.
- Component Instancing Changes in Visual Basic
- Lists class and constructor access levels for the Visual Basic 6.0 programmer.
- Walkthrough: Authoring a Component with Visual Basic .NET
- Provides step-by-step instructions for creating your own component.
- Ways to Implement Component Functionality
- Recommends when users should use a class, a structure, or (for Visual Basic users) a module to create a utility function or "helper" object.
- Authoring Components
- Describes the steps for creating your own component.
- Component Authoring
- Lists topics about creating your own components.
- Implementing Properties, Methods, Members, and Events in Components
- Details the use of properties, methods, and member variables in your component.