Click here to Skip to main content
15,881,859 members
Articles / Programming Languages / C#

How To Add ToolTips To Controls On A Windows Form

Rate me:
Please Sign up or sign in to vote.
3.57/5 (34 votes)
1 Feb 2001CPOL 250.3K   2.9K   35   14
Tips on how to add tooltips to controls on windows form in the .NET framework

This article is a tip on how to add tooltips to controls on a windows form. Just follow the following steps and the form designer will take care of all the code addition into the source file.

  1. From the ToolBox drop a ToolTip control on the form for which you want to add the tooltips.
  2. Then click on the control that you want to add the tooltip.
  3. In the properties page of that control you will see a ToolTip property. Just add the text that you want to show up as a ToolTip for the control.

When you add a ToolTip control to a form, it is active by default. Therefore, you do not have to do anything to make it active. If you look at the source file for your form, you will see code that looks something like as follows.

C#
private System.WinForms.ToolTip m_wndToolTip;

this.m_wndToolTip = new System.WinForms.ToolTip (this.components);

m_wndToolTip.SetToolTip (PictureButton, "Click Me!");
m_wndToolTip.SetToolTip (m_wndIntTextBox, "Enter Integer data type value.");

The SetToolTip method associates ToolTip text with the given control. If you wish to deactivate the ToolTip control, simply set the Active property to false.

C#
m_wndToolTip.Active = false;

The attached demo project contains a simple form with two edit controls. One is for entering double type data and second is for entering integer type data. When you move the mouse over these controls, the tooltips for the corresponding controls will be displayed.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 3 Pin
Casey Sheridan13-Dec-12 16:16
professionalCasey Sheridan13-Dec-12 16:16 
GeneralMy vote of 5 Pin
Cesar Sampaio30-Aug-12 5:40
Cesar Sampaio30-Aug-12 5:40 
GeneralMy vote of 5 Pin
Developer028-Sep-11 6:11
Developer028-Sep-11 6:11 
Justo lo que necesitaba, gracias.
GeneralMy vote of 1 Pin
Fran Moreno29-Jun-11 17:14
professionalFran Moreno29-Jun-11 17:14 
GeneralMy vote of 3 Pin
pankaj8820-Jun-11 18:23
pankaj8820-Jun-11 18:23 
GeneralMy vote of 4 Pin
pepe3w16-Mar-11 6:53
pepe3w16-Mar-11 6:53 
GeneralMy vote of 1 Pin
ammar11014-Nov-10 23:06
ammar11014-Nov-10 23:06 
GeneralMy vote of 4 Pin
rwadew19-Oct-10 9:57
rwadew19-Oct-10 9:57 
GeneralMy vote of 1 Pin
KarstenK1-Sep-10 20:41
mveKarstenK1-Sep-10 20:41 
QuestionFor Delegate Pin
Dhaval S Shah24-Mar-07 18:40
Dhaval S Shah24-Mar-07 18:40 
QuestionHow about 'WithEvents Pin
Anonymous19-Oct-03 21:48
Anonymous19-Oct-03 21:48 
Generalmore to the tooltips topic Pin
Dmitri2-Nov-02 8:11
Dmitri2-Nov-02 8:11 
GeneralRe: more to the tooltips topic Pin
zitun27-Jan-09 5:44
zitun27-Jan-09 5:44 
Generalif you add a tooltips Pin
zjwuweim31-Aug-02 17:07
zjwuweim31-Aug-02 17:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.