Click here to Skip to main content
12,450,967 members (48,704 online)
Click here to Skip to main content
Add your own
alternative version

Stats

229K views
2.8K downloads
35 bookmarked
Posted

How To Add ToolTips To Controls On A Windows Form

, 1 Feb 2001 CPOL
Rate this:
Please Sign up or sign in to vote.
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.

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.

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)

Share

About the Author

Naveen K Kohli
United States United States
No Biography provided

You may also be interested in...

Pro
Pro

Comments and Discussions

 
GeneralMy vote of 5 Pin
Cesar Sampaio30-Aug-12 5:40
memberCesar Sampaio30-Aug-12 5:40 

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.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160826.1 | Last Updated 2 Feb 2001
Article Copyright 2001 by Naveen K Kohli
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid