How can I get a right value in label2 that when I click on the equal button at the second or more time? Please help.. I am stuck
private void button3_Click(object sender, EventArgs e)
{
if (label1.Text == "0" || isActivity == true) {
label1.Text = ""; isActivity = false;
}
if (label1.Text.Length < 28)
label1.Text += "9";
else
SystemSounds.Beep.Play();
}
private void button12_Click(object sender, EventArgs e)
{
//label2 is a label to keep all process -and- isActivity is a boolean to apply operators whether pressed
//result is decimal variable to keep data to compute
//label1 is a label to keep values when click on numbers's button
//op is a string variable to keep operators */-+
if (label2.Text == "") {
label2.Text = label1.Text + "+";
result = Convert.ToDecimal(label1.Text);
isActivity = true;
op = "+";
}
else if (label2.Text.Contains("=")) {
label2.Text += "+";
isActivity = true;
op = "+";
}
else {
label2.Text += label1.Text + "+";
result += Convert.ToDecimal(label1.Text);
label1.Text = result.ToString();
isActivity = true;
}
}
Here is also a screen capture