473,748 Members | 2,276 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.ObjectDi sposedException

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.ObjectDi sposedException was unhandled
Message="Cannot access a disposed object.\r\nObje ct name:
'ExportDialog'. "
Source="System. Windows.Forms"
ObjectName="Exp ortDialog"
StackTrace:
at System.Windows. Forms.Control.C reateHandle()
at System.Windows. Forms.Form.Crea teHandle()
at System.Windows. Forms.Control.g et_Handle()
at System.Windows. Forms.Control.S etVisibleCore(B oolean value)
at System.Windows. Forms.Form.SetV isibleCore(Bool ean value)
at System.Windows. Forms.Control.S how()
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 8750
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.ObjectDi sposedException was unhandled
Message="Cannot access a disposed object.\r\nObje ct name:
'ExportDialog'. "
Source="System. Windows.Forms"
ObjectName="Exp ortDialog"
StackTrace:
at System.Windows. Forms.Control.C reateHandle()
at System.Windows. Forms.Form.Crea teHandle()
at System.Windows. Forms.Control.g et_Handle()
at System.Windows. Forms.Control.S etVisibleCore(B oolean value)
at System.Windows. Forms.Form.SetV isibleCore(Bool ean value)
at System.Windows. Forms.Control.S how()
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
3785
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 ad-infinitum). So can you put a try catch handler in the Disconnect_Click handler to trap the exception so you can, say, write the exception yttace out to a file. You need to know which obejct is generating the exception, whether it is one of your Windows Forms...
0
2598
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 information: Cannot access a disposed object named "System.Net.Sockets.NetworkStream". We are making a webmethod call that gets back a simple ID
0
6070
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 the stream before accessing the same.But here i am not releasing the stream.Suggestions/pointers will be appreciated. Thanks in advance Ashish
0
849
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 = OpenSQLConnection() If cboGroup.SelectedIndex <> -1 Then If txtMessage.Text <> String.Empty Then Dim strMobileNo As String strMobileNo = "select c.mobile from smsGroup s ,contact c where s.alias=c.alias...
1
3937
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 will take me to a new form. In this new form I use the ChooseContactDialog class to obtain a contact name from the phone book and store it into a text box. However, I am getting a System.ObjectDisposed Exception when it enters into the "On Click...
2
3941
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 causing breakdown. Here are these information : Type de l'événement : Erreur Source de l'événement : ASP.NET 2.0.50727.0
0
3062
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 display the forms f1,f2 and f3.If first checkbox is checked then it displays the f1 form.Similarly for f2 and f3 also.I kept all this code in the display button click event.In f1.vb,f2.vb and f3.vb I added back and next buttons. I wrote some code to...
5
4977
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 exception. An exception of type 'System.ObjectDisposedException' occurred in System.Windows.Forms.dll but was not handled in user code Additional information: Cannot access a disposed object.
2
3192
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 column: Dim colQtyShipped As New DataGridViewNumericUpDownColumn With colQtyShipped .Increment = 1 .Minimum = 0
0
8995
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9558
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9253
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8250
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3316
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2216
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.