c# - How do I call an event method from a different method? -
i want run method inside different method.
this method want call/run.
private void button1_click(object sender, eventargs e) { } thanks help.
you can call event method directly, it's considered poor practice so.
move shared code out of event method, separate method can called wherever happen need it.
private void button1_click(object sender, eventargs e) { someactionstoperform(); } private void someothermethod() { someactionstoperform(); } private void someactionstoperform() { // code needs run several places }
Comments
Post a Comment