我想浏览表单,所以当我客户端 buttonKlient 时,我转到 Form2,然后当我单击控件“x”时,我回到 Form1,我得到:
(fk
是Form2
)
private void button1_Click(object sender, EventArgs e) {
if (fk == null)
fk = new OknoKlient();
fk.Tag = this;
fk.Show(this);//here is ObjectDisposedException
Hide();
}
然后在Form2
protected override void OnFormClosing(FormClosingEventArgs e) {
if (e.CloseReason == CloseReason.WindowsShutDown) return;
var form1 = (Form1)Tag;
form1.Show();
Hide();
// DO WHATEVER HERE
}
当我单击打开时,我通过控件将其关闭,button1
然后再次单击 button1 并出现异常。Form2 fk
x
ObjectDisposedException