开发者

pass button click event through several usercontrols to a form and let another usercontrol know the button clicked

开发者 https://www.devze.com 2023-01-28 10:58 出处:网络
I know it sounds complex but thats true. I have a winform(clientFile) which in a project. It uses an usercontrol in another project. This usercontorl is FinancialManager.It is initialized in construct

I know it sounds complex but thats true. I have a winform(clientFile) which in a project. It uses an usercontrol in another project. This usercontorl is FinancialManager.It is initialized in constructor.

In FinancialManager, there is another child usercontrol(FinancialService) which is initialized in constructor too.

In FinancialService, it has a button and in the button click event, it initialized the last usercontrol(FinancialItem).

I need to use WINFORM and C# to let my usercontrol(timeControl) which is in the ClientFile(initialized in page_load) know the button in FinancialItem is clicked.

is there any good way to do it? If you can give a sample code, 开发者_运维技巧that will be perfect.

Thank you.

by the way, those usercontrols are in one project. except my usercontrol(timeControl).


Since you can control the code in your own usercontrols, it seems to me like you want to add a custom event in one of your usercontrols. Then diferent code can subscribe to this event and will know if the event was triggered.

...but it was a bit hard to understand exactly what you wanted...

Look up a basic event tutorial, and you're probably good to go.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号