从用户控件中捕获父控件事件 [英] catching parent control event from user control
本文介绍了从用户控件中捕获父控件事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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(.....) {
}
这篇关于从用户控件中捕获父控件事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文