Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 183
  • Last Modified:

How do I copy the selected items from one listbox to another?

I have two listboxes.  I want the selected items in the first box to be copied to the second box on a button click event.

The listbox names are lbFiles and lbDelete.  I want lbFiles to copy to lbDelete.


Private Sub btnRight_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRight.Click
        lbDelete = lbFiles.SelectedItems
End Sub
0
scross1276
Asked:
scross1276
1 Solution
 
nickhoggardCommented:
Hi,

Try this

        For Each objItem As Object In lbFiles.SelectedItems
            lbDelete.Items.Add(objItem)
        Next

Cheers

Nick
0
 
scross1276Author Commented:
Worked great man, thanks!!!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now