Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.
how can i collect all tooltip objects used on form.

I want something like as follows:-


C#
foreach (Control c in this.Controls)
           {
               if (c is ToolTip)
               {
                   //do something with tooltip control
               }
           }


But its not working...
Posted
Comments
Krunal Rohit 20-Feb-14 8:17am    
Why would you do that ?
-KR

1 solution

ToolTips are a Component; they are not "added" to a Form's ControlsCollection, or to Container Controls' ControlsCollection in a Form, in the Designer.cs file of a Form.

You can build a collection of ToolTips like this:
C#
public List<ToolTip> tTipList = new List<ToolTip>();

// in some method, or EventHandler like Form_Load
// requires Linq, and Collections.Generic:
tTipList = this.components.Components.OfType<tooltip>().ToList();</tooltip>
Rather weird syntax, imho.
 
Share this answer
 
v2
Comments
RhishikeshLathe 26-Feb-14 7:18am    
Thanks sir,
Thats what i am looking for.
Thanks once again.
You are always helpfull to me.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900