title: Creating Calculator in C#, need help implementing math logic/something else
body: <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Windows.Forms;
  
  namespace WindowsFormsApplication1
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
  
          bool plus;
          bool minus;
          bool multiply;
          bool divide;
  
          private void button0_Click(object sender, EventArgs e)
          {
              textBox1.Text = textBox1.Text + "0";
          }
  
          private void button1_Click(object sender, EventArgs e)
          {
              textBox1.Text = textBox1.Text + "1";
          }
  
          private void button2_Click(object sender, EventArgs e)
          {
              textBox1.Text = textBox1.Text + "2";
          }
  
          private void button3_Click(object sender, EventArgs e)
          {
              textBox1.Text = textBox1.Text + "3";
          }
  
          private void button4_Click(object sender, EventArgs e)
          {
              textBox1.Text = textBox1.Text + "4";
          }
  
          private void button5_Click(object sender, EventArgs e)
          {
              textBox1.Text = textBox1.Text + "5";
          }
  
          private void button6_Click(object sender, EventArgs e)
          {
              textBox1.Text = textBox1.Text + "6";
          }
  
          private void button7_Click(object sender, EventArgs e)
          {
              textBox1.Text = textBox1.Text + "7";
          }
  
          private void button8_Click(object sender, EventArgs e)
          {
              textBox1.Text = textBox1.Text + "8";
          }
  
          private void button9_Click(object sender, EventArgs e)
          {
              textBox1.Text = textBox1.Text + "9";
          }
  
          private void buttonPlus_Click(object sender, EventArgs e)
          {
              if (textBox1.Text == "")
                  return;
              else
              {
                  plus = true;
                  textBox1.Text = textBox1.Text + " + ";
              }
          }
  
          private void buttonDivide_Click(object sender, EventArgs e)
          {
              if (textBox1.Text == "")
                  return;
              else
              {
                  divide = true;
                  textBox1.Text = textBox1.Text + " / ";
              }
          }
  
          private void buttonMinus_Click(object sender, EventArgs e)
          {
              if (textBox1.Text == "")
                  return;
              else
              {
                  minus = true;
                  textBox1.Text = textBox1.Text + " - ";
              }
          }
  
          private void buttonMultiply_Click(object sender, EventArgs e)
          {
              if (textBox1.Text == "")
                  return;
              else
              {
                  multiply = true;
                  textBox1.Text = textBox1.Text + " * ";
              }
          }
  
          private void buttonClear_Click(object sender, EventArgs e)
          {
              textBox1.Text = string.Empty;
          }
  
          private void buttonEquals_Click(object sender, EventArgs e)
          {
              if (plus)
              {
  
              }
  
              if (minus)
              {
  
              }
  
              if (multiply)
              {
  
              }
  
              if (divide)
              {
  
              }
          }
  
  
      }
  }
  </code></pre>
  
  <p>The part I am stuck on, is after I press a math button (+,-,/,*). I only want one character to show in the textbox, unless I press another number.</p>
  
  <p>Example: Right now, this is what happens:
  87 + + + + + + + +</p>
  
  <p>I want 87 +
  and I want it where I can add another if the user adds another number, so like 87 + 87 + etc.</p>
  
  <p>Also, I need a little direction when it comes to adding the math logic.</p>
  
  <p>I was thinking of somehow storing whatever was in the string prior to a math sign in a variable, then doing the same for the numbers proceeding the math sign. Is that fine or is there an easier/less complicated way to accomplish this?</p>