How to get the items with ListView control selected?

Отвечено How to get the items with ListView control selected?

  • 1 мая 2012 г. 17:30
     
     

    I want to add a tooltip for items of Listview. I use the code below.

    Private Sub ListViewProjectsList_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListViewProjectsList.SelectedIndexChanged
            If ListViewProjectsList.SelectedItems.Count = 0 Then
                MsgBox("No Items is seledted at all")
            End If
            ToolTip1.SetToolTip(ListViewProjectsList, ListViewProjectsList.SelectedItems(0).Text)

     End Sub

    I click one of the item within my listview control.  I think I have already selected it.

    It enter into sub ListViewProjectsList_SelectedIndexChanged(). However it pop up a box say "No Items is seledted at all".


    Why? How can I get the item selected.

    Thanks in advance.

Все ответы