委托、事件--实现窗体传值!
一、主窗体界面
Form2 frm = new Form2();
frm.AccountEvent += new Form2.AccountDelegate(frm_AccountEvent);
frm.Show();
二、工具界面
public delegate void AccountDelegate(string number);
public event AccountDelegate AccountEvent;
private void button1_Click(object sender, EventArgs e)
{
if (AccountEvent!=null)
{
AccountEvent(textBox1.Text);
Close();
}
}