forum

Home / DeveloperSection / Forums / Main method returns if submethod has stoped by return in C#

Main method returns if submethod has stoped by return in C#

Anonymous User 1613 27-Jan-2015

Say I have two EventHandlers:

private void button1_click(object sender, EventArgs e)
{
   //Do first stuffs
 
   button2_click(sender, e);
 
   //Do second stuffs
}
 
private void button2_click(object sender, EventArgs e)
{
   //Do somthing
 
   if(myCondition) return; //Also return in button1_click
 
   //Do somthing else
}

Is there any way to return in button1_click and skip //Do second stuffs part if button2_clickhas stopped with return?

I'm looking for a way other than using a public bool variable to check if myCondition in button2_click is true

 


Updated on 27-Jan-2015
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By