Click here to Skip to main content
15,904,416 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am using thin kind of code but it doesn't work ?

string[] data = listbox1.item

Array.Sort(data);
listbox2.DataSource = data;

Listbox1:
CCC
BBB
AAA


Listbox2 should be:
AAA
BBB
CCC

But with that code above I cant....
Posted

1 solution

A little time reading this[^] should help you to find the answer.
 
Share this answer
 
Comments
h7h7h7 16-Apr-12 9:59am    
Yes I ssw it, but there are more explained things in common....there are only one short work.....who work more with c# can solve it
Richard MacCutchan 16-Apr-12 10:03am    
Sorry I don't understand your comment. If you follow that link and look at the Items property you will even find some sample code that will do what you want. All it takes is a little effort.
h7h7h7 16-Apr-12 10:14am    
Yeah. My english is not so good. I looked in that link but i didn't solve the problem. I just want the data in the list box to save in a any variable and then this variable to equal with another listbox...( I think you didn't understand me again )!
Richard MacCutchan 16-Apr-12 10:30am    
Yes, I understand you perfectly, go and read the section I refer to in the message above. It explains how to add items to a listbox and how to extract them, including sample code.
h7h7h7 16-Apr-12 10:38am    
yes ye Richard I am still on it. I have a listbox with items, now this items I have to sort and so sorted to put in another listbox...! I have problem to implement in a code I have idea....!

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900