Click here to Skip to main content
14,358,698 members
Rate this:
Please Sign up or sign in to vote.
See more:
how to Add selected data from a List box to another list box in double clik or with a add button
Posted
Updated 7-Jun-11 20:55pm
v3
Comments
   
Not a question. What's your problem?
--SA
beginner in C#.net 8-Jun-11 2:12am
   
done any code...
Ragi Gopi 8-Jun-11 2:20am
   
iam trying this ..
http://www.codeproject.com/KB/aspnet/List_Box_Control.aspx
Sunasara Imdadhusen 8-Jun-11 2:25am
   
You should start something...

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Unfortunately, ListBox.SelectedItems does not return anything that can be fed directly into ListBox.AddRange, so you have to loop:
foreach (object o in listBox1.SelectedItems)
    {
    listBox2.Items.Add(o);
    }
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100