473,378 Members | 1,531 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 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 8720
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Richard Blewett [DevelopMentor] | last post by:
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...
0
by: Naveen | last post by:
Hello all, Environment - Winforms app calling into a webservice Exception returned - "A first chance exception of type 'System.ObjectDisposedException' occurred in system.dll" Additional...
0
by: Ashish | last post by:
I am using the following code and i am getting the following error :- "Cannot access a closed file." while reading the content of the InputStream. Microsoft suggestes that one should not release...
0
by: mista852003 | last post by:
Private Sub btnSendNow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSendNow.Click Dim arr(1000) As String Dim conn As OleDbConnection =...
1
by: Treadstone | last post by:
Hi All, I am writing an application in C# (.NET CF) to generate a vCard and transmit it over bluetooth. To do this, on the menu item of a form, i generate an "On click Menu Item" event and that...
2
by: Bernard Borsu | last post by:
Hi ! My website breakdown at least 20 times per day with a System.ObjectDisposedException. The only information available are those given by the httpmodule treating the unhandledexception...
0
by: sdanda | last post by:
Hai i am working on vb.net. In my application I created four forms.Those are first.vb,f1.vb,f2.vb and f3.vb In firstvb I added 3 checkboxes and a "display" button.The 3 checkboxes are used to...
5
by: Brian | last post by:
Hello all. I have a simple application that I was using to test and understand the System.Timers.Timer and noticed that when I stop the application, on occasion, it throughs the following...
2
by: LLcoolQ | last post by:
I have created a DataGridViewNumericUpDownColumn using this from MSDN: http://msdn.microsoft.com/en-us/library/aa730881(vs.80).aspx I build my grids at run-time, here is the code for adding the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.