472,096 Members | 1,198 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,096 software developers and data experts.

'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 3493

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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.