public Form1() { InitializeComponent(); this.txtResult.Text = "0"; gArithmetic = eArithmetic.None; gVal1 = 0; }
private void btnArithmetic_Click(object sender, EventArgs e) { Button btn = (Button)sender; if (btn.Text == "÷") { gArithmetic = eArithmetic.Div; } if (btn.Text == "×") { gArithmetic = eArithmetic.Mutl; } if (btn.Text == "-") { gArithmetic = eArithmetic.Sub; } if (btn.Text == "+") { gArithmetic = eArithmetic.Add; } //Val1 + Val2 = Result gVal1 = Decimal.Parse(this.txtResult.Text); this.txtResult.Text = "0"; }
private void btnClear_Click(object sender, EventArgs e) { this.txtResult.Text = "0"; gArithmetic = eArithmetic.None; gVal1 = 0; }