Click here to Skip to main content
15,889,096 members
Articles / Web Development / ASP.NET

Remove multiple items from ListBox

Rate me:
Please Sign up or sign in to vote.
5.00/5 (6 votes)
14 May 2010CPOL 13.3K   8  
public static void RemoveSelected(this ListControl source){ foreach (var item in source.Items.Cast().Where(li => li.Selected).ToList()) source.Items.Remove(item);}protected void btnRemove_Click(object sender, EventArgs e){ lstCity.RemoveSelected();}

Views

Daily Counts

License

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


Written By
Web Developer
Sweden Sweden
Software developer

Comments and Discussions