I have a CheckedListBox control that I fill with DataGridView Column HeaderText values. If these columns are visible, I would like to set the CheckedListBox Items to "Checked". My code is as follows:
Whenever this code runs, I get the following error:Code:For Each col As DataGridViewColumn In frmTimingP2P.dgvOverview.Columns If col.Visible = True Then For Each item In clbOverviewColumnOrder.Items Dim intItemIndex As Integer = clbOverviewColumnOrder.Items.IndexOf(item) If col.HeaderText = item.ToString Then clbOverviewColumnOrder.SetItemCheckState(intItemIndex, CheckState.Checked) End If Next End If Next
"List that this enumerator is bound to has been modified. An enumerator can only be used if the list does not change."
What causes this? How can I get around this issue?
Thanks




Reply With Quote
