ListView Key Update Possible?

Is it possible to update the key of a listview I can add and delete items, but update would be cleaner, if possible.


Thanks


Answer this question

ListView Key Update Possible?

  • MuscleHead

    Yes you can, the ListViewItem.Name property (misnamed a bit) is the key for the item and can be assigned. For example, this code works fine:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    With ListView1
    .Items.Add("key0", "Test", -1)
    Dim item As ListViewItem = .Items("key0")
    item.Name = "key1"
    item = .Items("key1")
    Debug.Print("{0}", item.Text)
    End With



  • DarrellMerryweather

    Thanks! You're right, the name is kinda crappy. I'll try this tonite and let you know later.

  • ListView Key Update Possible?