System.ObjectDisposedException

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martin Pöpping

    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.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
  • Tom Porterfield

    #2
    Re: System.ObjectDi sposedException

    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

    Comment

    • Martin Pöpping

      #3
      Re: System.ObjectDi sposedException

      I just found the error.

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


      Regards,
      Martin

      Comment

      • Tom Porterfield

        #4
        Re: System.ObjectDi sposedException

        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

        Comment

        Working...