c# - Call performclick() from another form without make an instance of it -


i have static var in application , if var true want perform click in form how can in clean way without make instance of form this:

private  mainform _main 

i want performclick on button without make instance of form.

edit:

edit_customer mainformchild = new edit_customer(); formlist.add(mainformchild); mainformchild.show(); 

that form should have event fires when main form something.

public class edit_customer {     public event action somethinghappened;//todo give meaningful name } 

fire event @ appropriate time.

the main form can add handler event when creating form, within can whatever wants:

edit_customer mainformchild = new edit_customer(); mainformchild.somethinghappened += () => dosomething(); mainformchild.show(); 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -