Arda B

Arda B

  • 1.7k
  • 37
  • 4.8k

System.ObjectDisposedException was unhandled

Mar 3 2014 6:47 AM

I face with that issue, I checked some links on the Internet but failure to find an viable.

My issue comes out when I close second form's FormClosed event I think a delegate causes this matter. First is a login form when login passes correctly then I make the first form hide and second forms come alone on the screen. That delegate for a stopwatch that I show elapsed time on the statusbar. Here is some code.

this.Hide(); MainForm mainform = new MainForm(); mainform.strUser = txtUsername.Text; mainform.ShowDialog();  public delegate void doupdate(); public void UpdateLabel() { doupdate db = new doupdate(DoUpdateLabel); this.Invoke(db); }  public void DoUpdateLabel() { labelItem2.Text = timeelepse; }  private void MainForm_FormClosed(object sender, FormClosedEventArgs e) { Application.Exit(); }



Answers (3)