|
-
Feb 23rd, 2008, 06:15 AM
#1
Thread Starter
New Member
sorting data in listbox
i am displaying text in a listbox that i am getting from variables and i want to be able to sort it alphabetically from a-z and z-a by clicking a button but i can find anywhere the code needed to sort the data held in the listbox but all i can do is sort it using the properties but this only sorts it a-z.
the data in the variables comes from a text file.
-
Feb 23rd, 2008, 07:01 AM
#2
Re: sorting data in listbox
You've got two main choices:
1. Inherit the ListBox class and override the Sort method, adding functionality to sort in ascending and descending order.
2. Put your data in an array and bind it to the ListBox. You can then Sort and Reverse the array and rebind it each time.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|