title: Data validation and list of errors within one message box c#
body: <p>Hope you all well. I would like to ask you for an advise. </p>
  
  <p>I am looking for a way to validate a data before OnClick button gets executed.
  I do have few ComboBoxes with some data to choose from. Currently I have used some solution, which does look quite "dirty" and I am not happy about it.</p>
  
  <p>Currently I am using something similar to this:</p>
  
  <pre><code>if(box1 == null)
  {
     MessageBox.Show("Error 1");
  }
  if(box2 == null)
  {
     MessageBox.Show("Error 2");
  }
  if(box3 == null)
  {
     MessageBox.Show("Error 3");
  }
  </code></pre>
  
  <p>If I am having 3 fields empty I will get message displayed 3 times one for each error. Is there a way to list all errors within one message box if error is true?</p>
  
  <p>I was thinking of something like this:</p>
  
  <pre><code>bool a = true;
  bool b = true;
  bool c = true;
  
  a = (box1 == null);
  b = (box2 == null);
  c = (box3 == null);
  
  if(a || b || c)
  {
    //Display list of errors where condition is true
  }
  </code></pre>
  
  <p>I would highly appreciate any suggestions.</p>
  
  <p>Many thanks in advance.</p>