.Net DizzyCoding

Windows Forms ToolTip will not re-appear after first use

Problem :

I have a Windows Forms C# application where I would like to use a tooltip on one of the text boxes. I initialize the tool-tip in the constructor of the Form class, and it works the first time. So when I hover over the text box with my mouse it works, but once the toolTip times out and it goes away, it does not re-appear when I move my mouse away and back onto the control. I would expect it to come back. What am I doing wrong?

Here is how I initialize the tooltip:

myTip = new ToolTip();
myTip.ToolTipIcon = ToolTipIcon.Info;
myTip.IsBalloon = true;
myTip.ShowAlways = true;

myTip.SetToolTip(txtMyTextBox,"My Tooltip Text");

Solution :

I had a similar problem today. Sometimes, the tooltip would not show. I had one ToolTip control for all the controls in my form.

I also had a MouseEnter event on all the controls added automatically, so I modified the MouseEnter event to do:

_tooltip.Active = false;
_tooltip.Active = true;

It fixed the bug, but I don’t know why.

Also, the bug always happened on Windows XP machines, but not on Windows Vista.

I guess you’ll be happy to know that Microsoft knows about it…since about 5 years…

  • 2/21/2005 Bug acknowledged as reproducable
  • 3/29/2005 Hum we might fix it, but later…
  • 11/15/2005 Well actually it’s not a big bug, and it doesn’t happen much, so we won’t fix it.

Damn I love it when I stumble on bugs Microsoft doesn’t want to solve! This time it’s called a corner case, last time it was simply too difficult to resolve


I’m off to tell my client that the bugs in my program are just corner cases and too difficult to resolve…

I had a similar problem today. VS 2010 SP1 .Net 3.5
After AutoPopDelay-Time the ToolTip do not show the Controls ToolTipText.
Kevins solution is the only way to solve the problem.

I encapsulate this in my own ToolTip class:

public class ToolTip : System.Windows.Forms.ToolTip 
    public ToolTip() : base() { }

    public ToolTip(System.ComponentModel.IContainer components) : base(components) { }

    public new void SetToolTip(System.Windows.Forms.Control ctl, string caption) 
        ctl.MouseEnter -= new System.EventHandler(toolTip_MouseEnter);
        base.SetToolTip(ctl, caption);
        if(caption != string.Empty)
        ctl.MouseEnter += new System.EventHandler(toolTip_MouseEnter);

    private void toolTip_MouseEnter(object sender, EventArgs e) 
        this.Active = false;
        this.Active = true;

I had this issue in VB.NET. What I did was drop a TooTip control on the form, and then on the target control’s MouseHover event, I set the properties of the ToolTip. I did this because I used one ToolTip control for five different Label controls. It worked great. (Really, I wanted the ToolTip to show immediately, so I used the MouseEnter event instead.) I can post my exact code tomorrow when I get to work.

I solved this problem by this

if (t == null)
    t = new ToolTip();
t.IsBalloon = true;
t.ToolTipTitle = "Stop";
t.ToolTipIcon = ToolTipIcon.Error;
t.Show("", yourControlonWhichToApplyToolTip, 0);

t.Show("PDescription", yourControlonWhichToApplyToolTip, 1000);

Note i have added an empty tooltip.

For what it’s worth, I was having this problem on my Windows XP system until I noticed that if I placed at least one tooltip control on my form manually (from the toolbox) I could create as many tooltips as needed within my code, and they would all work.

If, however, I tried to create all tooltips in code (say for instance in the formload event) the tips would only show once and never to be seen again. I can’t give you the exact “why this happens” story, but I have duplicated this issue several times always with the same effect. It might have something to do with the object scope, but I’m not sure.

So now just as a habit, I always include at least one Visual Studio tooltip control and then the rest within my code.

I just had the the problem on Windows 7 so I found this thread.

In my case this did not work in tooltip_MouseEnter:

tooltip.Active = false;
tooltip.Active = true;

So I tried the following:

this.toolTip.SetToolTip(this.txtbx1, "tooltip-text");

This worked fine for me.

In my case after setting the tooltip text with the SetToolTip method, I used the Show overload with duration parameter, i.e.

toolTip.Show(text, textEdit, 1000);

After that tooltip did not reappear on mouse hover, and resetting tooltip.Active didn’t work..

A workaround that worked for me was to use Show overload without the duration, and hide it manually afterwards:

toolTip.Show(text, textEdit);
new Task(() =>
    textEdit.Invoke(new Action(() => toolTip.Hide(textEdit)));

With this code I have the desired behaviour, i.e.

  1. The tooltip is shown at once for 750 millisec. after the tooltip text has changed
  2. The tooltip does appear for the specified time when the mouse is over the control
System.Windows.Forms.ToolTip ToolTip1 = new System.Windows.Forms.ToolTip();

private void textBox_MouseHover(object sender, EventArgs e)
    ToolTip1.Show("YOUR TEXT", textBox);

private void textBox_MouseLeave(object sender, EventArgs e)
    ToolTip1.Active = false;
    ToolTip1.Active = true;
Exit mobile version