Tooltip problem

T

Tim Zych

I'm displaying a tooltip related to a listbox based on the selected item.

It works well except when I move the cursor away from the listbox and then
hover back over it, the tooltip pops up history for each item I have
selected. For example, let's say I select an item. The tooltip pops up with
the text. Good. Then I select a 2nd item, and the tooltip shows that text.
Good. Then, I drag the cursor away from the listbox. The tooltip disappears.
Good. Then I drag it over the listbox. The tooltip will pop up 2 items,
which are the 2 previously-viewed items. Not good. If I select 20 listbox
items and perform the same steps, the tooltip displays 20 items when I
re-hover over the listbox. Not good.

What am I doing wrong?

Here's my code:

Private Sub MyListBox_SelectedIndexChanged(.....) Handles etc..
Dim t As Tooltip
Dim i as ItemClass

' Set a reference to the item to display additional info for
i = MyListBox.SelectedItem()

t = New Tooltip
With t
.ShowAlways = False
.InitialDelay = 50
.AutoPopDelay = 5000
.ReshowDelay = 1000
.SetToolTip(Me.MyListBox, i.MyExtraInfo)
End With
 
T

Tim Zych

I'm loading data into the listbox using a class.

ExtraInfo is a member of that class. ExtraInfo is some extra info related to
the selected item, added to the tooltip to provide the user with more
information about their selection.
 
S

Stuart Nathan

I haven't checked your code, but my guess is the 'New' statement.
You may need to dispose of the previous tooltip first.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top