title: c# enable button only if All fields are filled in Text boxes
body: <p>I'm pretty stuck here and I need help.
  I got a lot of text boxes in my form, some visible and some invisible.</p>
  
  <p>I want that Button2 will be active only when all text boxes (that are not hidden) are not empty (At least one character or number)</p>
  
  <p>I saw all kinds of codes, but I could not figure out how to do it. (and it's not working for me)</p>
  
  <p>For example here's a code  that I tried, but it did not work out.</p>
  
  <pre><code> bool invalid = this.Controls.OfType&lt;TextBox&gt;()
           .Where(t =&gt; t.Visible)
            .Any(t =&gt; string.IsNullOrWhiteSpace(t.Text));
  
          if (invalid)
              button2.Enabled = false;
  </code></pre>
  
  <p>I would also like an explanation if it possible.</p>
  
  <p>Thank you!</p>