I have added code for plus button, but how i write code for other buttons? My code is

double total1 = 0;
        double total2 = 0;
        private void plus_Click(object sender, EventArgs e)
        {
            total1 = total1 + double.Parse(textBox1.Text);
            textBox1.Clear();
        }
        private void equal_Click(object sender, EventArgs e)
        {
            total2 = total1 + double.Parse(textBox1.Text);
            textBox1.Text = total2.ToString();
            total1 = 0;
        }
        private void minus_Click(object sender, EventArgs e)
        {
            total1 = double.Parse(textBox1.Text) - total1;
            textBox1.Clear();            
        }
        private void divide_Click(object sender, EventArgs e)
        {
            total1 = total1 + double.Parse(textBox1.Text);
            textBox1.Clear();
        }
        private void multiply_Click(object sender, EventArgs e)
        {
            total1 = total1 + double.Parse(textBox1.Text);
            textBox1.Clear();
        }

Are you using postfix or infix notation? If you are using infix then I don't see how your plus code will work because you can't do the calculation until you know the second operand nd you won't know that until you press a second operator (or =). For example, most calculators work like this using infix

123                  push and display 123
+                    push +
17                   push and display 17
=                    display 123+17

or

123                  push and display 123
+                    push +
17                   push and display 17
-                    push - and display 123+17
9                    push and display 9
=                    display 140-9

You have to keep track of the last operator pressed so you know what calculation to perform when you click the next operator.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.