Greetings everyone,
hope you all have a lovely weekend. so i have this new question which pins me down atm, Alright here i go : "C#" i have this listBox1, i want to transfer all the items to another ListBox, however They have to be Sorted Ascending. if anyone can point me in right direction that'll be most welcome!
As always, Thank you for reading this topic :)
Loading
Masoud APosted May 16, 2015, 3:07 PM
Manoj BhoirPosted May 16, 2015, 12:52 AM
You can either use ListBox.Sort Method.
Sort forces the collection to add each item back to itself if the Sorted property is true. Each item is then inserted into the correct position.
Or you can simply add Items of First ListBox into List
I hope this will help you.
Akhil GargPosted May 16, 2015, 12:51 AM
Nanhe SiddiquePosted May 16, 2015, 12:35 AM
Munesh SharmaPosted May 16, 2015, 12:23 AM
Sorting a list of items in a list box
ArrayList q = new ArrayList();
foreach (object o in listBox4.Items) q.Add(o);
}
q.Sort();
listBox5.Items.Clear();
foreach(object o in q)
{ listBox5.Items.Add(o);
}
Afzaal Ahmad ZeeshanPosted May 15, 2015, 10:09 PM