ToolTip Control in VB.NET
ToolTip Control is used to display brief description of the control whenever focus is set on that control. Brief description contains information such as for which purpose this control is used or which type of input should be accepted by that control.
Properties of ToolTip Control
Various Properties of ToolTip Control are:
|Name||It is used to specify name of the ToolTip Control.|
|Active||It is used to determine weather ToolTip Control will be Active or Not. It has boolean value. Default value is true. ToolTip will appear only when this property is set to true.|
|InitialDelay||It is used to specify amount of time the mouse pointer should remain on the control to display ToolTip text.|
|AutoPopDelay||It is used to specify amount of time the ToolTip text remains visible if mouse pointer remains on the control.|
|IsBallon||It is used to determine weather ToolTip will be displayed in the form of ballon or not. It has boolean value. Default value is false.|
|ToolTipIcon||It is used to set icon to be displayed in the ToolTip. It can have following values: None,Info,Error,Warning. Default value is None.|
|ToolTipTitle||It is used to set title to be displayed in each ToolTip.|
|UseAnimation||It is used to determine weather animations are used when ToolTip is display and Hide. It has boolean value.Default value is true.|
|ShowAlways||It is used to determine weather ToolTip will be displayed always even if the parent window is not active. It has boolean value. Default value is false.|
|StripAmpersands||It is used to determine weather ampersand (&) will be displayed in the ToolTip text or not. It has boolean value. Default value is false. If it is set to true then ampersand (&) will not display in the ToolTip text.|
Methods of ToolTip Control
Various Methods of ToolTip Control are:
|SetToolTip||It is used to specify ToolTip text to be display when mouse pointer is on particular control.
|GetToolTip||It is used to retrieve ToolTip text associated with particular control.
|RemoveAll||It is used to remove all ToolTip text associated with ToolTip Control.
Example of ToolTip Control
Design a Form as shown below:
Now set the Properties of various control as follow
|Control Name||Property Name||Value|
|Form1||Text||ToolTip Control Demo|
Now double click on the form and write following code in the load event of form.
ToolTip1.SetToolTip(txtNumber1, "Enter Number1")
ToolTip1.SetToolTip(txtNumber2, "Enter Number2")
Now double click on Ad button and write following code in the click event of Add Button.
Dim a As Integer, b As Integer, c As Integer
a = Val(txtNumber1.Text)
b = Val(txtNumber2.Text)
c = a + b
MsgBox("Addition=" & c)