ListViewItem.ToolTipText Property


Gets or sets the text shown when the mouse pointer rests on the ListViewItem.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

Public Property ToolTipText As String

Property Value

Type: System.String

The text shown when the mouse pointer rests on the ListViewItem.

If both the ListViewItem and its containing ListView have ToolTips set, only the ToolTip for the ListViewItem will be shown.

The following code example demonstrates how to use the ListView.ShowItemToolTips and ToolTipText properties. To run this example, paste the code into a Windows Form and call InitializeItemsWithToolTips from the form's constructor or Load event-handling method.

' Declare the ListView.
Private ListViewWithToolTips As ListView

Private Sub InitializeItemsWithToolTips() 

    ' Construct and set the View property of the ListView.
    ListViewWithToolTips = New ListView()
    ListViewWithToolTips.Width = 200
    ListViewWithToolTips.View = View.List

    ' Show item tooltips.
    ListViewWithToolTips.ShowItemToolTips = True

    ' Create items with a tooltip.
    Dim item1WithToolTip As New ListViewItem("Item with a tooltip")
    item1WithToolTip.ToolTipText = "This is the item tooltip."
    Dim item2WithToolTip As New ListViewItem("Second item with a tooltip")
    item2WithToolTip.ToolTipText = "A different tooltip for this item."

    ' Create an item without a tooltip.
    Dim itemWithoutToolTip As New ListViewItem("Item without tooltip.")

    ' Add the items to the ListView.
    ListViewWithToolTips.Items.AddRange(New ListViewItem() _
        {item1WithToolTip, item2WithToolTip, itemWithoutToolTip})

    ' Add the ListView to the form.

End Sub

.NET Framework
Available since 2.0
Return to top