I am using a background worker for some reason I am getting an error that saids collection cannot be modified error, 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;
Where does the Background worker thread come in?
What is ImportStatusList in this code? Is that the UltraListView?
Are you saying that you are referring to the UltraListView control (which is on the UI Thread) from another thread?
You cannot do that.
Ok so the background worker is on the main form thread, so stepping through code today the i get the error whether its UltraListView or UltraGrid Control, the problem is the "ImportStatusList " this is a list. The underlying datasource cannot be modified for some reason, First time ever catching this error in history, so I am learning about it now.
Now the ultralistview control is on another form, I simply pass the "ImportStatusList " to the form to show the status of the import class. I am trying to set either a grid or list view . Keep in mind i am using the background worker to do all the processing of import log object below. So how to fix this error that i am getting, can you give me some advice
List<ImportLog> ImportStatusList = new List<ImportLog>();
public DateTime StoptDateTime;