1. Herfried K. Wagner’s VB.Any
  2. .NET
  3. Frequently Asked Questions

Adding tooltips to items of a listview control

Adding tooltips to items of a listview control
<URL:https://dotnet.currifex.org/dotnet/faqs/listviewitemtooltips/en/>
----------------------------------------------------------------------------

Adding tooltips to items of a listview control

'ListViewItem' doesn't provide a property to set an item's tooltip text. A
simple workaround is to assign the tooltips to the items' 'Tag' property,
place a ToolTip component on the form and add this code:

\\\
Private m_HoveredItem As ListViewItem

Private Sub ListView1_MouseMove( _
    ByVal sender As Object, _
    ByVal e As MouseEventArgs _
) Handles ListView1.MouseMove
    Dim lvi As ListViewItem = Me.ListView1.GetItemAt(e.X, e.Y)
    If Not lvi Is m_HoveredItem Then
        m_HoveredItem = lvi
        If lvi Is Nothing Then
            Me.ToolTip1.SetToolTip(Me.ListView1, "")
        Else
            Me.ToolTip1.SetToolTip(Me.ListView1, lvi.Tag)
        End If
    End If
End Sub
///