[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? :ehh:
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
Re: Access disposed object
Oh I see. I solved it by doing as you said :)