Visual Studio 2010 Tooltip control in VB.NET

In this article, we will learn how to create and use a Tooltip control in a Windows Forms application using Visual Studio 2010.
  • 18347

In this article, we will learn how to create and use a Tooltip control in a Windows Forms application using Visual Studio 2010.

Tooltip Control

Tooltip Control is used to display explanatory text when the mouse rest on a control or window. This control is helpful in providing a quick help to users or display information when the user moves the pointer over an associated control.

Creating a tooltip

Tooltip class is used to create a tooltip control. tooltip class object need to call a method SetToolTip.

c# code:

private void Form1_Load(object sender, EventArgs e)

        {

           ToolTip tool = new ToolTip();

           tool.SetToolTip(button1, "press the button");

        }

VB code:

Dim tool As New ToolTip()

tool.SetToolTip(button1, "Press the button.")

Now execute the application press ctrl+F5 and move the pointer over the associated control.

tool.gif
 

Figure 1.

Tooltip Properties

Active - Determine if the tooltip is active.

IsBalloon  - Indicates weather the tooltip will take on a balloon form.

ShowAlways - Determines if the tooltip will be displayed always, even if the parent window is not active.

ToolTipIcon -Determines the icon that is shown on the tooltip.

ToolTipTitle -Determines the Title of tooltip window.

Now taking a tooltip control on the form and set the above property of tooltip control.

  tool1.gif

Figure 2.

Now right click on the button and select property tooltip on tooltip1 of button control.

tool2.gif
 

Figure 3.

set the property Isballoon on true in the tooltip property window to display the tooltip as a balloon.
 

Now execute the application and move the pointer over the associated control.

tool4.gif
 

Figure 4.

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.