C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Sorting Items in ListBox


Posted Date: 01 Mar 2007    Resource Type: Code Snippets    Category: Collections

Posted By: Padma       Member Level: Diamond
Rating:     Points: 10



In .net 1.1 there is no default method available for sorting items in listbox. so we have to sort the items manually. Try with the following method to sort.


ArrayList alItems=new ArrayList();
foreach(ListItem lst in this.lstFiles.Items)
{
alItems.Add(lst .Text);
}

alItems.Sort();
this.lstFiles.DataSource=alItems;
this.DataBind();


The above code sample adds all items from the listbox to an array list and uses the Sort property of the ArrayList.




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: How to convert the dynamic ArrayList in to a Fixed Size Array List?
Previous Resource: How to use a SortedList
Return to Discussion Resource Index
Post New Resource
Category: Collections


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

Help Desk

Contact Us    Privacy Policy    Terms Of Use