NOTE: operand menas the digits you are multiplying not the operation youa re performing on them. So i changed operand to operation
public partial class Calculator : Form
{
public Calculator()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double a, b, r;
string Operation = textBox2.Text.ToString();
{
switch ( Operation )
{
case " + " :
a = double.Parse(textBox1.Text);
b = double.Parse(textBox3.Text);
r = a+b;
textBox4.Text = r.ToString();
break;
case " - ":
a = double.Parse(textBox1.Text);
b = double.Parse(textBox3.Text);
r = a-b;
textBox4.Text = r.ToString();
break;
case " * ":
a = double.Parse(textBox1.Text);
b = double.Parse(textBox3.Text);
r = a*b;
textBox4.Text = r.ToString();
break;
case " / ":
a = double.Parse(textBox1.Text);
b = double.Parse(textBox3.Text);
r = a/b;
textBox4.Text = r.ToString();
break;
default:
result = "This is not an operand";
break;
}
}
}
}
I have not tested the code but its as simple as clicking on the button will generate your result on textbox4 on the basis of TextBox1 (operand),textBox3(operand) and textbox2(operation).