Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi

 

I am getting a strange error.

 

"Collection was modified; enumeration operation may not execute."

 

I am loading a dataset with data from a sql server stored procedure. Using this code:

 

 

_db.LoadDataSet("SR_USER_MNE_ALL", dsFlux, New String() {"User"})

 

It uses Microsoft�s patterns and practices data access. It has only recently started happening after some new users were setup in the database. I have checked the data being returned and it matches the dataset requirements for this table.

 

The code is not running in a thread and the datatable is wiped before this code runs.

 

Does anyone have any ideas? Thanks in advance.

Posted

After further investegation, I have found the following is happening.

 

There is a list box which is bound to the User datatable. When the above code runs, the SelectedIndexChanged event is firing on this list box which is infact producing the error.

 

is there any way to prevent this?

Posted

I don�t know if there is a way to temporarily disable an event?

 

In the meantime I have just set a Boolean value which prevents SelectedIndexChanged running on load. This Boolean value is un-set after the form loads all the data.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...