I'm currently adding a tooltip to a label like so:
ToolTip LabelToolTip = new System.Windows.Forms.ToolTip();
LabelToolTip.SetToolTip(this.LocationLabel, text);
When I need to change this tooltip as the label's text changes, I try doing the same to add a new tooltip. Unfortunately, the old tooltip remains under the new one, which is really annoying. Is there a method to remove the old tooltip, or should I just make a new label when I want to change the text in a label?
Create a single instance of the ToolTip
and use it whenever you like to show it using the SetToolTip
method and use Hide
method to hide it. Generally it is not necessary to create more than one ToolTip
instance.
The tooltip object works in multiple Controls at the same time.
Create a single instance of the ToolTip and use it for adding and removing a ToolTip of any Control.
When adding you should simply use .SetToolTip(Control, "Message that will apear when hover") When removing you just set it back to null with .SetToolTip(Control, null).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With