3
Reply

System.ObjectDisposedException was unhandled

Ask a question
Sinan Basalan

Sinan Basalan

10y
3.4k
1

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)