110,534
社区成员
发帖
与我相关
我的任务
分享
private void button1_Click(object sender, EventArgs e)
{
Form2 f = new Form2();
f.GetText += GetText;
f.Show();
}
private string GetText()
{
return this.txtID.Text.Trim();
}
B窗体:
public delegate string GetTextEvent();
public event GetTextEvent GetText;
private void button1_Click(object sender, EventArgs e)
{
string text = string.Empty;
if (this.GetText != null)
{
text = this.GetText();
}
Console.WriteLine(text);
}