Hi, thanks for helping.

All this code does is remove the checked items. I want to remove it from one listview box and transfer it to another. Is that possible?

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        With ListView1
            If .CheckedItems.Count > 0 Then
                For checked As Integer = .CheckedItems.Count - 1 To 0 Step -1
                    .Items.Remove(.CheckedItems(checked))
                Next
            End If
        End With
    End Sub

Recommended Answers

All 4 Replies

See if this helps.

For Each lvItem As ListViewItem In ListView1.Items
            If lvItem.Checked = True Then
                Dim newLvItem As New ListViewItem(lvItem.Text)
                '//-- if it contains subitems. --\\
                'newLvItem.SubItems.Add(lvItem.SubItems(1).Text)
                'newLvItem.SubItems.Add(lvItem.SubItems(2).Text)
                ListView2.Items.Add(newLvItem)
                ListView1.Items.Remove(lvItem)
            End If
        Next
Member Avatar for Unhnd_Exception

ListView1.BeginUpdate()
ListView2.BeginUpdate()
For Each li As ListViewItem In ListView1.CheckedItems
ListView1.Items.Remove(li)
ListView2.Items.Add(li)
Next
ListView1.EndUpdate()
ListView2.EndUpdate()

Ok, I understand now. Thanks Codeorder. :)

dim listviewitem as new listviewitem
listviewitem= Me.listview1.SelectedItems.Item(0)
listview2.Items.Add(listviewitem.Clone())

?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.