jch001 Posted October 11, 2006 Posted October 11, 2006 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. Quote
jch001 Posted October 12, 2006 Author Posted October 12, 2006 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? Quote
jch001 Posted October 12, 2006 Author Posted October 12, 2006 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.