1

I'm coding in Visual Studio 2019 and I get the following error message: "Collection was modified; enumeration operation might not execute". It happens when I try to save a dataset with the method WriteXml:

myDataset.WriteXml(myPath)

Due to the fact that I modify the dataset with other methods connected to events, maybe the modification could happens during the WriteXml, but to avoid this situation I fisrt copy the dataset and then use the second dataset for the WriteXml:

Dim myDs As DataSet = myDataset
myDs.WriteXml(myPath)

Could somebody help me? Thank you

Dario Fore
  • 11
  • 2

0 Answers0