David Smith

David Smith

  • NA
  • 2k
  • 0

List view collection modified error

Mar 20 2012 11:18 AM

I am using a background worker for some reason I am getting an error that saids collection  modified error, enumeration may not be executed, I am basically launching the Listview thats on a form, to always give me import status on data on a list view, I am able to close and open the list view at any given time.

Can someone point me how to get pass this error when I am trying to launch the form to look the update of the list view.

public void LoadList(List<ImportLog> ImportList)

{

if (ImportList != null){

// save the ImportStatusList for later

this.ImportStatusList = ImportList;

foreach (ImportLog Status in this.ImportStatusList)//Error occurs

{AddStatus(Status);}

}

else

{

MessageBox.Show("Message Viewer is Empty"

);

Visible = false;



Answers (6)