|
-
Nov 14th, 2011, 05:47 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Access disposed object
I am displaying a form, then closing it using the normal:
this.Show();
this.Close();
But when I am trying to open it a second time I get this error:
Code:
Cannot access a disposed object.
Object name: 'MyForm'.
I have never gotten this before on other projects. Is it something I have missed?
-
Nov 14th, 2011, 08:02 AM
#2
Re: Access disposed object
When you close the form, you've disposed of it, so you will need to re-instantiate it to open it again.
If you want to use the form again, you could always use ShowDialog and then that would require that you dispose of the form manually when you're done with it.
You can find more on the form.close method here: http://msdn.microsoft.com/en-us/libr...orm.close.aspx
-
Nov 14th, 2011, 11:50 AM
#3
Thread Starter
Hyperactive Member
Re: Access disposed object
Oh I see. I solved it by doing as you said
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|