label1 is ok,
but label2 is not ok and get error ,
private void button1_Click(object sender, EventArgs e)
{
double a = Convert.ToDouble(textBox1.Text);
double b = Convert.ToDouble(textBox2.Text);
double z = Convert.ToDouble(label1.Text);
label1.Text = (a + b).ToString(); // it is ok
label2.Text = (z + a).ToString(); // not ok and get error
}
Yes, there are a few syntax errors. Not only that, but once you get your code to compile and run, you will a runtime error. I decided it is easiest to correct the code and comment on what the problem was and how and in some cases, why you should do it a different way.
Remember, even with the code I provide, you may still receive runtime (notcompile time) errors based on what the end user enters. Use the pattern I supplied to make the additonal adjustments (read the comments next to the new and old code.