472,111 Members | 1,926 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

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 8621
On Sat, 28 Oct 2006 15:20:11 +0200, Martin Pöpping wrote:
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();
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 Pöpping 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
reply views Thread by leo001 | 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.