469,364 Members | 2,398 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

System.ObjectDisposedException

Hello,

I´ve a problem with a small line of code.
For my Windows Application I designed a form for exporting data into xml
files.

I´m opening the dialog with:

ExportDialog export = new ExportDialog();
export.Show();

and I´m getting the following exception:

System.ObjectDisposedException was unhandled
Message="Cannot access a disposed object.\r\nObject name:
'ExportDialog'."
Source="System.Windows.Forms"
ObjectName="ExportDialog"
StackTrace:
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Form.CreateHandle()
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.SetVisibleCore(Boolea n value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.Show()
at [...]

What do I do wrong?

Another form, my import dialog works fine with the same lines of code:
ImportDialog import = new ImportDialog();
import.Show();

Regards,

Martin
Oct 28 '06 #1
3 8488
On Sat, 28 Oct 2006 15:20:11 +0200, Martin Ppping wrote:
Hello,

Ive a problem with a small line of code.
For my Windows Application I designed a form for exporting data into xml
files.

Im opening the dialog with:

ExportDialog export = new ExportDialog();
export.Show();

and Im getting the following exception:

System.ObjectDisposedException was unhandled
Message="Cannot access a disposed object.\r\nObject name:
'ExportDialog'."
Source="System.Windows.Forms"
ObjectName="ExportDialog"
StackTrace:
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Form.CreateHandle()
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.SetVisibleCore(Boolea n value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.Show()
at [...]

What do I do wrong?

Another form, my import dialog works fine with the same lines of code:

ImportDialog import = new ImportDialog();
import.Show();
Where in your form (what method or event) is the ExportDialog code?
--
Tom Porterfield
Oct 28 '06 #2
I just found the error.

Because of a copy&paste mistake I had a this.close() in the
Export class constructor. ;)
Regards,
Martin
Oct 28 '06 #3
On Sat, 28 Oct 2006 16:28:06 +0200, Martin Ppping wrote:
I just found the error.

Because of a copy&paste mistake I had a this.close() in the
Export class constructor. ;)

Regards,
Martin
That would cause that type of problem.
--
Tom Porterfield
Oct 29 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Richard Blewett [DevelopMentor] | last post: by
2 posts views Thread by Bernard Borsu | last post: by
2 posts views Thread by LLcoolQ | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.