title: Cannot use the local variable before it is declared
body: <p>Must be missing something basic here, but trying to make a simple calculator app, heres a piece of my code, when I try to run it its giving me;</p>
  
  <p>"Error  1   Cannot use local variable 'xxxxxx' before it is declared. The declaration of the local variable hides the field xxxxx</p>
  
  <pre><code>public partial class Form1 : Form
  {
      public Form1()
      {
          InitializeComponent();
  
  
      }
  
      double total1 = 0;
      double total2 = 0;
      bool plusBtnPressed = false;
      bool minusBtnPressed = false;
      bool timesBtnPressed = false;
      bool divideBtnPressed = false;
  
  
      private void textBox1_TextChanged(object sender, EventArgs e)
      {
  
      }
  
  
      private void button3_Click(object sender, EventArgs e)
      {
          if(plusBtnPressed == true) {
              total2 = total1 + double.Parse(txtDisplay.Text);
          }
  
          else if (minusBtnPressed == true) {
              total2 = total1 - double.Parse(txtDisplay.Text);
          }
  
          else if (divideBtnPressed == true) {
              total2 = total1 / double.Parse(txtDisplay.Text);
          }
          else if (timesBtnPressed == true) {
              total2 = total1 * double.Parse(txtDisplay.Text);
          }
  
  
          bool plusBtnPressed = false;
          bool minusBtnPressed = false;
          bool timesBtnPressed = false;
          bool divideBtnPressed = false;
      }
  
  
      private void btnPlus_Click(object sender, EventArgs e)
      {
          total1 += double.Parse(txtDisplay.Text);
          plusBtnPressed = true;
          minusBtnPressed = false;
          divideBtnPressed = false;
          timesBtnPressed = false;
          txtDisplay.Clear();
      }
  </code></pre>