tags:

views:

439

answers:

1

Hi guys.

Yes this question as already been asked here at SO.

The problem is that the solution for that question was hiding the tooltip, and i really need to remove not hide it.


I'm adding tooltips to several controls in my Form using a couple a functions i've made.

There are two functions, one to set the Tooltip to display on MouseHover, and another to show the Tooltip at all times.

Only one missing. One to remove any Tooltip that is been set or is being displayed by a specific control.

Something like

tooltip.remove(TextBox1);

Something that simple where i only need to set the Control where the tooltip is.

I've tried a couple things but didn't work.

Thanks.

EDIT:

This is how i use my code to add tooltips.

This was Coded the wrong way

My code to Set and Show Tooltips:

public class UserInterface
{
    public void SetTooltip(Control Object, string Message, string Title, ToolTipIcon icon, Boolean isBallon, Boolean showAlways)
    {
        ToolTip Tip = new ToolTip();
        Tip.UseAnimation = true;
        Tip.UseFading = true;
        Tip.ToolTipIcon = icon;
        Tip.IsBalloon = isBallon;
        Tip.ShowAlways = showAlways;
        Tip.ToolTipTitle = Title;
        Tip.SetToolTip(Object, Message);
    }

    public void ShowTooltip(Control Object, string Message, string Title, ToolTipIcon icon, Boolean isBallon, Boolean showAlways)
    {
        ToolTip Tip = new ToolTip();
        Tip.UseAnimation = true;
        Tip.UseFading = true;
        Tip.ToolTipIcon = icon;
        Tip.IsBalloon = isBallon;
        Tip.ShowAlways = showAlways;
        Tip.ToolTipTitle = Title;
        Tip.Show(Message, Object);
    }
}
+4  A: 

This should do it...

ToolTip.SetToolTip(TextBox1, null);

Hope this helps, Best regards, Tom.

tommieb75
Should work, i know that. But it didn't. Any other way.
Fábio Antunes
@Fabio: Tooltip is a design time constructor that is an extender to the controls...why did you instantiate a new tooltip? Drag the tooltip onto the form and use that instead! You are coding this wrong - you have two instances of tooltips..
tommieb75
@tommieb75: Uppps... no excuse. I fix it right away. Thanks.
Fábio Antunes
Its fixed. Sorry guys. Still some concepts about C# and .Net to learn.
Fábio Antunes
Your right. After some changes and following your comment its working pretty well. Thanks
Fábio Antunes
Works just as good in VB.NET also.ToolTip.SetToolTip(TextBox1, Nothing)
uzbones