Quantcast
Viewing all articles
Browse latest Browse all 12583

How to Remove ListItem from a ListBox

Hi friends

when i try to remove ListBox item(ListItem) its giving error

error  :

List that this enumerator is bound to has been modified. An enumerator can only be used if the list does not change.

i have only ListItem objects in my ListBox and my code as follows

foreach

(ListItem removeitem in listBox1.SelectedItems)

{

listBox1.Items.Remove(removeitem);

}

any help pls,

Regards

Ranadheer.


Viewing all articles
Browse latest Browse all 12583

Trending Articles