I want to iterate through a CheckedListView and delete the checked items ONLY.
Anybody know how to do this? Anybody know a rock solid way of doing this?
I have tried the following but get an exception
unhandled exception of type System.InvalidO perationExcepti on in
system.windows. forms.dll
Additionlal Info: The list that this enumerator is bound to has been
modified.
An enumerator can only be used if the list dosn't change.
Private Sub btnDelete_Click (ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnDelete.Click
Dim indexChecked, itemCount As Integer
Dim itemChecked As Object = ChkListBoxRouti nes.CheckedItem s
For Each itemChecked In itemChecked
ChkListBoxRouti nes.Items.Remov eAt(indexChecke d)
ChkListBoxRouti nes.Refresh()
Next
End Sub
Anybody know how to do this? Anybody know a rock solid way of doing this?
I have tried the following but get an exception
unhandled exception of type System.InvalidO perationExcepti on in
system.windows. forms.dll
Additionlal Info: The list that this enumerator is bound to has been
modified.
An enumerator can only be used if the list dosn't change.
Private Sub btnDelete_Click (ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnDelete.Click
Dim indexChecked, itemCount As Integer
Dim itemChecked As Object = ChkListBoxRouti nes.CheckedItem s
For Each itemChecked In itemChecked
ChkListBoxRouti nes.Items.Remov eAt(indexChecke d)
ChkListBoxRouti nes.Refresh()
Next
End Sub
Comment