title: Validating multiple fields
body: <p>I used Visual Studio to create an application that features 3 fields where 3 numbers can be added together. Now, I need to validate all 3 fields so that negative numbers cannot be added. If a negative number is entered, each field has also to return a unique message like: "please enter a positive first number."</p>
  
  <p>I figured out how to do that for one field, but how do I set it up for all 3 fields to not accept negative numbers (and display a unique message)?</p>
  
  <p>Here is what I have:</p>
  
  <pre><code>{
      int num = int.Parse(txtNum1.Text);
  
      if (num &lt;0)
      {
          MessageBox.Show("Please enter a positive first number");
      }
      else
      {
          int num1 = int.Parse(txtNum1.Text);
          int num2 = int.Parse(txtNum2.Text);
          int num3 = int.Parse(txtNum3.Text);
          int sum = num1 + num2 + num3;
          txtResult.Text = sum.ToString();
      }
  </code></pre>
  
  <p>Hopefully this makes sense.</p>