无法访问已释放的对象!!!!!

boloverr boloverr 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
以下是form1的代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace _20080517S2
{
public partial class MainForm : Form
{
From2 fa;
public MainForm()
{
InitializeComponent();
fa = new From2();
fa.MdiParent = this;
fa.WindowState = FormWindowState.Maximized;
fa.button1.Click += new EventHandler(button1_Click);

}

void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(fa.Timu);
fa.Close();


}

private void 增加题目ToolStripMenuItem_Click(object sender, EventArgs e)
{
fa.Show();
}
}
}


下面是form2的代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace _20080517S2
{
public partial class From2: Form
{
public From2()
{
InitializeComponent();
}
public string Timu
{
get { return this.textBox1.Text; }
}
public string XX1
{
get { return this.textBox2.Text; }
}
public string XX2 {
get { return this.textBox3.Text; }
}
public string XX3 {
get { return this.textBox4.Text; }
}
public string XX4 {
get { return this.textBox5.Text; }
}

private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(this.Timu);

}
}
}


第一次点击”增加题目“时 form2 正常SHOW出来!

输入完后 点FORM2的Button1关闭

然后第二次点击“增加题目”的时候就会出现 “无法访问已释放的对象” 的错误

为什么会这样

环境:VS2008
...全文
评论 6
收藏 已收藏
分享
返回顶部
boloverr
.NET Framework 17,748 成员 24,324 内容