Object Model - Additional Methods and Functions - GetSingleLineToolTip

Returns the SingleLineTTDatasource-object provided as extended property to a specific control.

[Visual Basic]
<ExtenderProvidedProperty()> _ 
Public Function GetSingleLineToolTip(ByVal acontrol As Control) As SingleLineTTDataSource
public SingleLineTTDataSource GetSingleLineToolTip(
	Control acontrol



The control, for which to retrieve the provided SingleLineTTDatasource-object.


This function is used to get access to the SingleLineTTDatasource-object of a specific control (acontrol) on the same form as the tooltip-component. An instance of this object is provided to each control on the same form by the SingleLineToolTip-component (ToolTipsFactorySingleLine). It is this object which holds the tooltip-content (and some other properties) used for the tooltip to be displayed for the specific control.

In the Visual Studio property-grid the access to the SingleLineTTDatasource-object of a specific control is seamlessly integrated in the property-list of the specific control. (See the chapter on "Provided Properties" for more information.)

To get access to the SingleLineTTDatasource-object of a specific control through code, things are not exactly as one would expect: The SingleLineTTDatasource-object is a property provided to a control by the tooltip component, and - if looking at the property-grid of the control - it definitely seems to be just a normal property of that control, but if you try to access this property by code as any other property of the control, you'll see that this is not possible, because the control does not expose such a property. Actually, the control, to which the tooltip-component provides this property, has absolutely no knowledge about this provided property, because this extended properties are managed by the providing component (in this case the SingleLineToolTip-component). Therefore the programmatic access to this properties has to happen through the providing component.  And that's where GetSingleLineToolTip() comes into play. GetSingleLineToolTip() requests and returns a reference to the SingleLineTTDatasource-object provided to the control (acontrol) specified in the function-call.

The following example shows how this looks in code:


Dim myToolTipDS As SingleLineTTDataSource


'Get a reference to the SingleLineTTDataSource-object

'of lblSales

myToolTipDS = Me.ImageTT.GetSingleLineToolTip(Me.lblSales)


'Through this reference we get now full access to all

'properties of this object. In this example we

'use this to assign new content (a dynamically

'computed text) for the tooltip displayed

'by lblSales...

myToolTipDS.Text = GetSalesPeriod()