Additional information: Cannot access a disposed object named

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • michael Schindler

    #1

    Additional information: Cannot access a disposed object named

    I get an error message since i installed visual studio 2003 :-(

    Please help me why i get this message?

    An unhandled exception of type 'System.ObjectD isposedExceptio n' occurred in
    system.windows. forms.dll

    Additional information: Cannot access a disposed object named
    "DataGridTextBo x".

    I get this after this syntax... i have no idea why i get this..

    has anywhere a idea?

    private void dataGridFiBuMan dantDetail_Clic k(object sender,
    System.Windows. Forms.MouseEven tArgs e)

    {

    // Bei Klick soll eine Detailmaske aufgehen

    // Abfragen ob der Event gestartet werden darf

    if (strEventMouseD own == "ON")

    {

    //string str = null;

    Point pt = new Point(e.X, e.Y);

    DataGrid.HitTes tInfo hti = dataGridFiBuMan dant.HitTest(pt );

    // Rechte Maustaste

    if(e.Button == MouseButtons.Ri ght)

    {

    MessageBox.Show ("Bitte mit der linken Maustaste anklicken, \n" +

    "um das Detail dieser Zeile anzuzeigen. \n"+

    "Das Löschen mit der Maus erfolgt später.");

    }

    // Linke Maustaste

    if ((e.Button == MouseButtons.Le ft) && (hti.Type ==
    DataGrid.HitTes tType.Cell))

    {

    frmHauptmenue.S trMandant = (dataGridFiBuMa ndant[hti.Row, 1].ToString());

    frmHauptmenue.I ntMandantID = (int)(dataGridF iBuMandant[hti.Row, 0]);

    this.Close();

    }

    }

    }






  • Horatiu Ripa

    #2
    Re: Additional information: Cannot access a disposed object named


    Hi,

    There's too less code for figuring out what's happening. It's a runtime
    error, so what's the line where this error occures? What was the previous
    actions you did before the error occured?

    Most probably the "Dispose" method of the form is started (this.Close()
    ?????), and that disposes all your controls on the form, and after that you
    are trying to call some method that refers some contol.

    --
    Horatiu Ripa

    "michael Schindler" <mr_werdy@hotma il.com> wrote in message
    news:uL8#BSfnDH A.2064@TK2MSFTN GP11.phx.gbl...[color=blue]
    > I get an error message since i installed visual studio 2003 :-(
    >
    > Please help me why i get this message?
    >
    > An unhandled exception of type 'System.ObjectD isposedExceptio n' occurred[/color]
    in[color=blue]
    > system.windows. forms.dll
    >
    > Additional information: Cannot access a disposed object named
    > "DataGridTextBo x".
    >
    > I get this after this syntax... i have no idea why i get this..
    >
    > has anywhere a idea?
    >
    > private void dataGridFiBuMan dantDetail_Clic k(object sender,
    > System.Windows. Forms.MouseEven tArgs e)
    >
    > {
    >
    > // Bei Klick soll eine Detailmaske aufgehen
    >
    > // Abfragen ob der Event gestartet werden darf
    >
    > if (strEventMouseD own == "ON")
    >
    > {
    >
    > //string str = null;
    >
    > Point pt = new Point(e.X, e.Y);
    >
    > DataGrid.HitTes tInfo hti = dataGridFiBuMan dant.HitTest(pt );
    >
    > // Rechte Maustaste
    >
    > if(e.Button == MouseButtons.Ri ght)
    >
    > {
    >
    > MessageBox.Show ("Bitte mit der linken Maustaste anklicken, \n" +
    >
    > "um das Detail dieser Zeile anzuzeigen. \n"+
    >
    > "Das Löschen mit der Maus erfolgt später.");
    >
    > }
    >
    > // Linke Maustaste
    >
    > if ((e.Button == MouseButtons.Le ft) && (hti.Type ==
    > DataGrid.HitTes tType.Cell))
    >
    > {
    >
    > frmHauptmenue.S trMandant = (dataGridFiBuMa ndant[hti.Row, 1].ToString());
    >
    > frmHauptmenue.I ntMandantID = (int)(dataGridF iBuMandant[hti.Row, 0]);
    >
    > this.Close();
    >
    > }
    >
    > }
    >
    > }
    >
    >
    >
    >
    >
    >[/color]


    Comment

    • michael Schindler

      #3
      Re: Additional information: Cannot access a disposed object named

      The problem is that:

      I think the new framework version is my problem...
      New i have 1.1 with vs 2003

      And i think the event mousedown is the problem.

      My code in short version..whit the same error:

      private void dataGridFiBuMan dantDetail_Clic k(object sender,
      System.Windows. Forms.MouseEven tArgs e)
      {
      this.Close();
      }

      if you have a solution..pleas e help me..

      thanks

      michael


      Comment

      Working...