winform使用委托和事件在窗体之间传值
2021-06-03 23:07
阅读:859
标签:使用 gate out res info toc style 目标 obj
定义委托和事件,并且触发这个事件
//定义委托 public delegate void ShowOutStockDelegate(ListoutStockResultDto); //定义事件 public event ShowOutStockDelegate ShowOutStockEvent; private void btnConfirm_Click(object sender, EventArgs e) { ShowOutStockEvent(outStockResultDtos); }
在目标窗体上,实例化上述窗体
FrmEndTask frmEndTask = new FrmEndTask(); //触发这个事件 frmEndTask.ShowOutStockEvent += new FrmEndTask.ShowOutStockDelegate(EndTask_ShowOutStockEvent); protected void EndTask_ShowOutStockEvent(ListoutStockResultDtos) { //这里就能拿到你想要的数据了 _outStockResultDtos = outStockResultDtos; }
winform使用委托和事件在窗体之间传值
标签:使用 gate out res info toc style 目标 obj
原文地址:https://www.cnblogs.com/siyunianhua/p/10886746.html
文章来自:搜素材网的编程语言模块,转载请注明文章出处。
文章标题:winform使用委托和事件在窗体之间传值
文章链接:http://soscw.com/index.php/essay/90165.html
文章标题:winform使用委托和事件在窗体之间传值
文章链接:http://soscw.com/index.php/essay/90165.html
评论
亲,登录后才可以留言!