Iterating through tooltips

Posted by icemanind on Stack Overflow See other posts from Stack Overflow or by icemanind
Published on 2010-05-19T01:30:11Z Indexed on 2010/05/19 1:40 UTC
Read the original article Hit count: 316

Filed under:
|
|

Guys, I have a windows form with a panel control and inside the panel control are several other controls with a System.Windows.Forms.Tooltip attached to them. How can I iterate through each tooltip and set the Active property of the tooltip to false? Tooltips, unlike other controls, are not actually controls. So I had this:

foreach (System.Windows.Forms.Control ctrl in this.pnlControl.Controls)
{
    if (ctrl.Name.StartsWith("tt")) // since all my tooltip names start with 'tt'
    {
        System.Windows.Forms.ToolTip TipControl=(System.Windows.Forms.ToolTip)ctrl;

        TipControl.Active=false;
    }
}

This does not work though. It gets an error because the ToolTip control is not inherited from System.Windows.Forms.Control. Any ideas?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET