Introduction to ExtenderProviders
An ExtenderProvider is a VB .NET component that adds a property to other controls. For example, if you add a ToolTip component to a form and click on a TextBox, the Properties window includs a property with a name such as "ToolTip on ToolTip1." The ToolTip component is an ExtenderProvider that provides a ToolTip property.
To build an ExtenderProvider:
- Create a new component (select the Project menu's Add Component command).
- Use an Implements statement to make the component implement the IExtenderProvider interface.
- Write the CanExtend function required by the IExtenderProvider interface. This function takes an object as a parameter and returns True if it can extend that object.
- Give the component a ProvideProperty attribute to tell Visual Basic the names of the properties that it will provide.
- Build get and set routines for those properties. These routines must have the same names as the properties with the words Get and Set added to the front.
- Compile the project.
- Install the component in the toolbox.
- Right-click on the toolbox and select Add/Remove Items.
- Browse to the directory that contains the executable you just made.
- Select the executable.
For some examples that include additional features such as toolbox bitmaps and default property values, see these HowTos:
|