phadaphunk phadaphunk - 7 months ago 38 Question

Tooltip showing twice

I'm showing a

on a certain button's
event. If I go over it once it works but if I leave, wait for the tooltip to disapear and come back on the button, it appears twice. I tried cancelling it on
but it still appear twice the seocnd time.

Private Sub someButton_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles someButton.MouseHover

Dim tooltipSearch As New ToolTip()
tooltipSearch.Show("I'm a tooltip"), someButton)

End Sub

Private Sub someButton_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles someButton.MouseLeave

Dim toolTip As New ToolTip()

End Sub

Am I missing something obvious?


You are using the ToolTip not in the way it should be used (also look at the documentation :) ). It is just like any other control, start by dragging it onto your form (like you do with other controls).

If you have no dynamic text to be displayed in your tooltip, you can easily set the text in your constructor, using the method SetToolTip. If you do want some dynamic text, you can use this method in your MouseHover event.

Apart from that, you shouldn't do anything anything else. Just set the right delays on your tooltip and it should work all fine.