子窗体:
public partial class Search : DevComponents.DotNetBar.Office2007Form
{
public delegate void MyDelegate(IList<Model.Search> list);
public event MyDelegate MyEvent;
public Search()
{
InitializeComponent();
}
#region 查询
private void btnxSearch_Click(object sender, EventArgs e)
{
MyEvent(searchList);
}
#endregion
}
父窗体:
public partial class StaSearchForm : DevComponents.DotNetBar.Office2007Form
{
public StaSearchForm()
{
InitializeComponent();
}
//实例化
BLL.Staff stfBll = new BLL.Staff();
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSearch_Click(object sender, EventArgs e)
{
Search search = new Search(this.dgvxStaffDetailInfo);
search.MyEvent += new Search.MyDelegate(RefreshDgv);
search.ShowDialog();
}
private void RefreshDgv(IList<Model.Search> list)
{
this.dgvxStaffDetailInfo.DataSource = stfBll.GetByParam(list); //调用方法查询
this.dgvxStaffDetailInfo.AutoGenerateColumns = false;
}