Extender providers are components that impart additional properties to controls.
Take the ToolTipProvider for example.
When you place an instance of a ToolTipProvider on a form, every control on that form receives a new property. This property can be viewed an set in the Properties window, where it appears as ToolTip on MyTooltip, where MyTooltip is the name of the ToolTipProvider.At run time, the value of this property is displayed in a yellow box when the mouse hovers over a control.
Extender providers are usually used to provide information to the users at run time. As we have seen, the ToolTipProvider can be used to provide Tool Tips at run time.
Other extender providers include the
To use an extender provider in your project
1. Add a component of the appropriate extender type (such as ErrorProvider) to your form. The component appears in the component tray.
2. In the Properties window, set appropriate values for the properties provided by the extender provider.
The properties provided by extender providers actually reside in the extender providers themselves, not within the controls they extend. Thus they are not true properties of the component and cannot be accessed in code at run time. The extender provider implements methods that can be used to access the properties it provides. By convention, these methods are always called Getprop and Setprop where prop is the name of the property provided.
Thus the ToolTipProvider implements methods named GetToolTip and SetTooltip, which can be used in code to access or dynamically change the value of the Tool Tip stored for a particular control. Both methods take a reference to the appropriate control as an argument, and theSet methods require a value to which the property is to be set.
To access the value of an extender property at run time
Use the Get method implemented for that property. You must supply a reference to the appropriate control.
Dim myToolTip As String
myToolTip = ToolTip1.GetToolTip(btnData)
To set the value of an extender property at run time
Use the Set method implemented for that property. You must supply a reference to the appropriate control and a new value for that property.
ToolTip1.SetToolTip(btnData, “Click me to display the data”