title: If one void function returns, how do I stop the next function call from executing?
body: <p>I have two different button clicks that call modified versions of the same function...</p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
  { SendEmail(); }
  
  private void button2_Click(object sender, EventArgs e)
  { SendRevisedEmail();}
  
  
  
  public void SendEmail()
  {
    DataManip(ref item1, ref item2);  //This is where I'd like the next 2 functions to not process if this one fails.
    UpdateDB(ref item1, ref item2);
    sendTechEmail(ref item1, ref item2);
  }
  
  public void SendRevisedEmail()
  {
    DataManip(ref item1, ref item2);  //This is where I'd like the next 2 functions to not process if this one fails.
    UpdateDB2(ref item1, ref item2);
    sendRevisedTechEmail(ref item1, ref item2);
  }
  </code></pre>
  
  <p>In the <code>DataManip</code> function, I have it performing some checks on the form and set to throw a pop-up Message and return; if it doesn't come out with a <code>flag1 = true</code>.</p>
  
  <pre><code>public void DataManip(ref string item1, ref string item2)
  {
    bool flag1 = false;
  
    foreach (Control c in groupBox1.Controls)
    {
      Radiobutton rb = c as RadioButton;
      if rb != null &amp;&amp; rb.Checked)
      {
        flag1 = true;
        break;
      }
    }
  
    if (flag1 == true)
    {
      //Manipulate Data here
    }
    else if (flag1 != true)
    {
      MessageBox.Show("You didn't check any of these boxes!");
      return;
    };
  }
  </code></pre>
  
  <p>As of right now, the flag1 check in <code>DataManip</code> works fine.  I can verify that it doesn't process the data changes if it is missing an entry in groupBox1.</p>
  
  <p>The problem is that within the <code>SendEmail()</code> and <code>SendRevisedEmail()</code> functions, it still processes the calls for the other functions after <code>DataManip(ref item1, ref item2)</code>.</p>
  
  <p>How can I cause an error to kick out of <code>DataManip</code> and prevent/skip those other two function calls from executing?</p>