Applying Tooltip to VB.Net Listview

  • Thread starter Thread starter Ken
  • Start date Start date
K

Ken

Hi all,

Please help! I'm attempting to apply tooltips to each
individual item in VB.Net's Listview control. In VB6 it
was easy - you just did the following
(assumes "myListView" is the name of the ListView
control):

set lst = myListView.ListItems.Add
lst.Text = "Test1"
lst.ToolTipText = "Test1 Label"

I can't work out the equivalent in the VB.Net Listview
control though. It seems that you have to add a Tooltip
control to the form, and then set which control it should
apply to, for example:

myToolTip.SetToolTip(myListView, "My Tooltip text")

However this only applies the tooltip to the whole
listview control, not the individual items.

Any help much appreciated!!

Cheers,

Ken
 
After you have dropped a Tooltip control on your form, Each of your controls
on your form will be extended so you will have a Tooltip property where you
can enter your text in the designer.

Regards

Niclas
 
Thanks Niclas - but the new property only applies to the
whole control, not to the individual items that have been
added to my listview control.

I've since answered my own question though... Within the
listview's MouseMove event, I added the following code:
MyToolTip.SetToolTip(MyListView, MyListView.GetItemAt
(e.X, e.Y).Text)

This creates new tooltip every time the mouse moves over
each item inside the listview control.

Cheers,

Ken...
 
Back
Top