title: How to disable button for some user?
body: <p>I have a table in a database which has a column of UserName and UserRights. UserRights is either <code>admin</code> or <code>user</code>
  Now, I want to disable some of buttons in another form if the UserName used to login in the <code>login form</code> is only a user. How will i do that? 
  I have the codes below:</p>
  
  <pre><code>    private void button1_Click_1(object sender, EventArgs e)
      {
          connection.Open();
          OleDbDataReader reader = null;
          OleDbCommand command = new OleDbCommand("select* from TableAcct", connection);
          reader = command.ExecuteReader();
          while (reader.Read())
          {
              uname.Add(reader["username"].ToString());
              password.Add(reader["userpassword"].ToString());
              rights.Add(reader["rights"].ToString());
          }
          connection.Close();
  
          int totalItems = uname.Count;
          int count = 0;
          string isValidated = "";
          while (count &lt; totalItems)
          {
              if ((Username.Text == uname[count].ToString()) &amp;&amp; (pword.Text == password[count].ToString()))
              {
                  isValidated = "True";
                  rights2 = rights[count].ToString();
                  count = 100;
              }
              else
              {
                  count++;
              }
          }
          if (isValidated == "True")
          {
              Mainform mainform1 = new Mainform();
              login.ActiveForm.Hide();
              mainform1.linkLabel1.Text = Username.Text;
              mainform1.ShowDialog();
              Username.Clear();
              pword.Clear();
  
          }
          else
          {
              MessageBox.Show("Invalid Log in. Please try again", "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
          }
  
      }
  </code></pre>