c# - How to get Usercontrol object 'X' from X's Button(i.e. Button inside the X) onclick event -


hello guys working on windows form application in .net c#.

now have user control button inside it. had write on-click handler in main form rather inside user-control itself. want know if there anyway can user-control object in button's on-click handler. since had make use of them few more times in same form. want know user-control's button click.

user control button 

thank :)

you can use event:

public delegate void buttonclicked(); public buttonclicked onbuttonclicked; 

you can subscribe event anywhere, instance, in mainform, have user control called demo;

demo.onbuttonclicked +=()  {    // put actions here. } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -