首先在Form2中定义委托和事件:
//声明委托 和 事件
public delegate void TransfDelegate(String value);
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
public event TransfDelegate TransfEvent;
private void button1_Click(object sender, EventArgs e)
{
//触发事件
TransfEvent(textBox1.Text);
this.Close();
}
} //声明委托 和 事件