Listview and Tooltips

  • Thread starter Thread starter James Proctor
  • Start date Start date
J

James Proctor

Hi, hope im posting this in the right place. Please put
me right if im wrong. I have just moved over to .net and
am still on the steep learning curve. In 6 i used to be
able to set it so that each cell in a List view control
which was set to details view could have a different
tooltip, i.e. one showing the content of the cell. I cant
seem to work out how to do this though in VB.net. Could
someone help me out. It would be a great help

Regards

JP
 
Hi,

You would have to add a tooltip control to your form. In the mouse
move event you would have to change the tooltip.

Private Sub ListView1_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseMove

Dim lvi As ListViewItem = ListView1.GetItemAt(e.X, e.Y)

Try

ToolTip1.SetToolTip(ListView1, lvi.ToString)

Catch

End Try

End Sub

Ken
 
Hi,

Thats really good thanx but it only works for the first
column in the listview. How can i do it so that it works
on all the colums. It maybe isnt possible anymore. Hope
you can help though. Thank you for your help so far.

JP
 
Hi,

Maybe this will help.
Private Sub ListView1_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseMove

Dim lvi As ListViewItem = ListView1.GetItemAt(8, e.Y)

Try

ToolTip1.SetToolTip(ListView1, lvi.ToString)

Catch ex As Exception

Debug.WriteLine(ex.ToString())

End Try

End Sub

Ken

-----------------------
 
That's great as far as it goes, but what's needed is a function that
looks like this:

Public Function GetSubItemAt( _
ByVal x As Integer, _
ByVal y As Integer _
) As ListViewSubItem


Unfortunately, there isn't one.
So in the absence of this function, how else can we find out which of
the members of the ListViewSubItemCollection is the mouse hovering
over?
 
Back
Top