469,282 Members | 1,909 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

'System.ObjectDisposedException' : Cannot access a disposed object

In theory there is nothing wrong with the Windows Forms part of your application (using your code as a start I mocked up the app and can happily press the connect and disconnect buttons ad-infinitum). So can you put a try catch handler in the Disconnect_Click handler to trap the exception so you can, say, write the exception yttace out to a file. You need to know which obejct is generating the exception, whether it is one of your Windows Forms objects or something in your remoting setup that we can't see.

The problem originates from an object having a method called or property accessed after IDisposable.Dispose has been called on it but which object that is and who is oding the accessing is what you need to find out.


Richard Blewett - DevelopMentor

Hi gurus!!!

I have a winform Application that starts with a Connection Form and then instanciates the Main Form.
When closing the main form by clicking the famous top right cross, it works fine but when i use the disconnect button (to go back to the connection form),
i have the exception System.ObjectDisposedException : Cannot access a disposed object.

I have read that it has a relation with the GC and/or the Dispose method but i'm a beginner in .net and i don't really understand the real problem.

If somebody has an idea to help me, it would be great!!!!

Thx a lot
Nov 16 '05 #1
0 3061

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by theinvisibleGhost | last post: by
3 posts views Thread by Martin Pöpping | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.