title: Validation C# Null Fields
body: <p>I want check some Items when user sign a registration form(unique Username , similar two passwords entered, the validity of the email, not the empty fields) This is my code. But not  work for blank fields. where is the problem?!</p>
  
  <pre><code>    private void button1_Click(object sender, EventArgs e)
      {
          try
          {
              //Check Username: if username is unavailable, goto catch and continue register
              var q = (from c in Session.DB.Guests
                       where c.UserName == textBox4.Text
                       select c).Single();
              MessageBox.Show("UserName is Not Available");
          }
          catch
          {
              try
              { // Here My code For Blank Fields:
                if (!(textBox1.Text == null &amp;&amp; textBox2.Text == null &amp;&amp; textBox3.Text == null &amp;&amp; 
                 textBox4.Text == null &amp;&amp; textBox5.Text == null &amp;&amp; textBox6.Text == null))  
  
                       if (!(textBox5.Text.Contains(textBox4.Text) || textBox5.Text != textBox6.Text)) //Check Password
                           if (textBox3.Text.Contains("@") &amp;&amp; textBox3.Text.Contains("."))
                          {
                              Controller.UserController.RegisterUser(textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text
                                  , textBox5.Text);
                              MessageBox.Show("Register!");
                          }
  
                      else
                          MessageBox.Show("Incorrect email address");
                  else
                      MessageBox.Show("Password Not match or contains username");
                  else MessageBox.Show("Empty Fields! All Fields Required!");
              }
              catch
              {
                  MessageBox.Show("Error");
              }
          }}
  </code></pre>