弹出窗体调用父窗体函数
如:子窗体关闭时,调用父窗体数据刷新函数,刷新数据。
计算机语言C#
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
//ParentForm
//定义委托
public delegate void RefrushHander();
public event RefrushHander RefrushEvent;
//确定提交
private void btnConfirm_Click(object sender, EventArgs e)
{
RefrushEvent();
this.Close();
}
//ChildForm
//新增信息,打开录入窗体
private void toolsbAdd_Click(object sender, EventArgs e)
{
ChildForm childForm = new ChildForm ();
childForm.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
childForm.RefrushEvent +=new ChildForm.RefrushHander(childForm_RefrushEvent);
childForm.ShowDialog();
}
//刷新页面数据事件
private void childForm_RefrushEvent()
{
this.Refrush();
}