dataset exception

A

Alex

Hi,

We have the following situation: The application has many forms and
one dataset which is shared by all forms. When forms are initialized,
the form controls bind to the dataset.

At some point, we need to do a dataset.Clear() - and exceptions are
thrown.
(ObjectDisposedException for "ComboBox" and IndexOutOfRange exception
<- for every row in the dataset's tables)

I believe that this is because the controls bind to the dataset, then
the forms close (and thus controls are disposed), but the dataset,
upon Clear tries to notify all subscribers.

Do you have any idea ?

Any help will be appretiated!
Thanks, Alex
 
W

William Ryan eMVP

Have you added any event handlers for the comobox or any of those objects?
Simply binding isn't the problem though. I'm guessing that it's referencing
the Combobox explicitly right so you're positive it's not the dataset that's
disposed of?

I'd look at the event listeners and if you've added any for those objects,
make sure you remove them as well ---- I'm not saying that just b/c you've
handled SelectedItemChanged for instance that this is causing it. But if
you add something after the form is loading to handle some event, make sure
you remove it when the form is closing.

--

W.G. Ryan, eMVP

http://forums.devbuzz.com/
http://www.knowdotnet.com/williamryan.html
http://www.msmvps.com/WilliamRyan/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top