title: Can't access a variable from another class: Invalid expression term 'public'
body: <p>Visual C# 2008 express.  Windows form; two textboxes and one button.  In the cmdEnter_Click event I want to check if the boolean variables in the ValidateForm class are true or not(to handle whether the textboxes get cleared or not).  </p>
  
  <pre><code>private void cmdEnter_Click(object sender, EventArgs e)
  {
       ValidateForm();
       txtName.Clear();
       txtAge.Clear();
  }
  
  public void ValidateForm()
  {
       bool bValidName = ValidateName();
       bool bValidAge = ValidateAge();
       if (bValidName &amp;&amp; bValidAge)
            MessageBox.Show("Entry will be added");               
       else
            MessageBox.Show("Please enter valid data");
  }
  </code></pre>
  
  <p>I changed the ValidateFrom() modifier from private to public and then put public in front of the boolean variable, so that I could acccess them but I receive the "Invalid expression term public" error. My understanding is that if the variable is public and inside a public class I should be able to access it from anywhere?  </p>