本文介绍了从用户控件中捕获父控件事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
HI, 我正在使用VB.Net Win Form应用程序.我在选项卡控件的选项卡页中添加了usercontrol.现在,如果标签页关闭,如何从用户控件中捕获事件? 即我需要从用户控件中获取父控件的事件. 谢谢
I am working on VB.Net Win Form application. I have add usercontrol in tab pages of a tab control. Now how to catch events from user control if tab page closing ? i.e. I Need to get parent control''s events from user control. Thanks
推荐答案您可以执行以下操作: You can do something like this: protected override void OnInit(....) { TabPage page = this.Parent as TabPage; if (page != null) { page.Closing+=ParentClosing(...); } } void ParentClosing(.....) { }
更多推荐
从用户控件中捕获父控件事件
发布评论