Solved

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

Posted on 2006-07-19
2
176 Views
Last Modified: 2006-11-18
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
Comment
Question by:scross1276
2 Comments
 
LVL 5

Accepted Solution

by:
nickhoggard earned 500 total points
ID: 17140919
Hi,

Try this

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

Cheers

Nick
0
 

Author Comment

by:scross1276
ID: 17140957
Worked great man, thanks!!!
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
vb.net winforms sizing/resolution? 4 45
Optimize the query 5 43
VS 2015 is giving [No relevant source lines] 2 30
VB.NET Application Installation with sqlserver 8 32
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question