title: I'm trying to get my memory functions to work on a C# calculator
body: <p>This is my code up to this point, As you might see i am quite new to coding and this code just won't work. Really looking for some help or tips.
  The memory functions just show a 0 if clicked and it isn't working at all.
  all the rest of these functions work as planned.
  Edit: I have updated the code. There seems to be some trouble with the decimal and double.</p>
  
  <pre><code>public partial class Form1 : Form
  {
      Double ResultaatWaarde = 0;
      decimal EindResult = 0;
      decimal MemoryStore = 0;
      string FunctieVoltooid = "";
      bool isFunctieVoltooid = false;
  
  
      public Form1()
      {
          InitializeComponent();
          TopMost = true;
      }
  
      // Nummers /. Getalen 
      private void button_click(object sender, EventArgs e)
      {
          if ((textBox_Resultaat.Text == "0") || (isFunctieVoltooid))
              textBox_Resultaat.Clear();
  
           isFunctieVoltooid = false;
  
          Button button = (Button)sender;
          if(button.Text == ",")
          {
              if (!textBox_Resultaat.Text.Contains(",")) 
              textBox_Resultaat.Text = textBox_Resultaat.Text + button.Text;
          }
          else
          textBox_Resultaat.Text = textBox_Resultaat.Text + button.Text;
      }
  
      // Functies
      private void Functie_click(object sender, EventArgs e)
      {
  
          Button button = (Button)sender;
  
          if (ResultaatWaarde != 0)
          {
  
              buttonIS.PerformClick();
              FunctieVoltooid = button.Text;
              HuidigeProcess.Text = ResultaatWaarde + " " + FunctieVoltooid;
              isFunctieVoltooid = true;
  
          }
          else
          {
  
              FunctieVoltooid = button.Text;
              ResultaatWaarde = Double.Parse(textBox_Resultaat.Text);
              HuidigeProcess.Text = ResultaatWaarde + " " + FunctieVoltooid;
              isFunctieVoltooid = true;
  
          }
  
      }
  
      //Clear Entries knop
      private void buttonClearEntries_Click(object sender, EventArgs e)
      {
  
          textBox_Resultaat.Text = "0";
  
      }
  
      // Clear Knop
      private void buttonClear_Click(object sender, EventArgs e)
      {
          textBox_Resultaat.Text = "0";
          ResultaatWaarde = 0;
          HuidigeProcess.Text = "";
      }
  
      // = Knop
      private void buttonIS_Click(object sender, EventArgs e)
      {
  
          switch(FunctieVoltooid)
          {
              case "+":
                  textBox_Resultaat.Text = (ResultaatWaarde + Double.Parse(textBox_Resultaat.Text)).ToString();
                  break;
  
              case "-":
                  textBox_Resultaat.Text = (ResultaatWaarde - Double.Parse(textBox_Resultaat.Text)).ToString();
                  break;
  
              case "*":
                  textBox_Resultaat.Text = (ResultaatWaarde * Double.Parse(textBox_Resultaat.Text)).ToString();
                  break;
  
              case "/":
                  textBox_Resultaat.Text = (ResultaatWaarde / Double.Parse(textBox_Resultaat.Text)).ToString();
                  break;
              case "x²":
                  textBox_Resultaat.Text = (ResultaatWaarde * ResultaatWaarde).ToString();
                  break;
              case " √":
                  textBox_Resultaat.Text = (Math.Sqrt(double.Parse(textBox_Resultaat.Text))).ToString();
                  break;
              case "1/x":
                  textBox_Resultaat.Text = (1 / ResultaatWaarde).ToString();
                  break;
              default:
                  break;
  
          }
          ResultaatWaarde = Double.Parse(textBox_Resultaat.Text);
          HuidigeProcess.Text = "";
  
      }
  
      // Memory knoppen
      private void memory_Click(object sender, EventArgs e)
      {
  
          Button gedruktebutton = (Button)sender;
          string ButtonText = gedruktebutton.Text;
  
  
          if (ButtonText == "MC")
          {
              //Memory Clear
              MemoryStore = 0;
              return;
          }
  
          if (ButtonText == "MR")
          {
              //Memory Recall
              txtDisplay.Text = MemoryStore.ToString();
              return;
          }
          if (ButtonText == "MS")
          {
              MemoryStore = Decimal.Parse(txtDisplay.Text);
              return;
          }
  
          if (ButtonText == "M-")
          {
              // Memory subtract
              MemoryStore = ResultaatWaarde;
              MemoryStore -= EindResult;
              txtDisplay.Text = MemoryStore.ToString();
              return;
          }
  
          if (ButtonText == "M+")
          {
              // Memory add 
  
              MemoryStore += EindResult;
              txtDisplay.Text = MemoryStore.ToString();
              return;
  
          }
  
      }
  
      private void textBox_Resultaat_TextChanged(object sender, EventArgs e)
      {
  
      }
  }
  
  
  }
  </code></pre>