private void button_Click(object sender, EventArgs e) { if (sender is Button) { Button button = (Button)sender; char buttonText = char.Parse(button.Text); //Debug //MessageBox.Show("button " + buttonText + " is clicked"); string formula; string result; calculatorLogic.AddDigit(buttonText, out formula, out result); labelFormula.Text = formula; labelResult.Text = result; } }
private void button_Click(object sender, EventArgs e) { //check that the sender object is a button type if (sender is Button) { Button button = (Button)sender; char buttonText = char.Parse(button.Text); //Debug MessageBox.Show("button " + buttonText + " is clicked"); string formula; string result; calculatorLogic.AddDigit(buttonText, out formula, out result); //populate the formula label //populate the result lable } }