I'm asked to press "0" button and it remains 0 instead of keeping increase "000000". What should I add in this code?
<pre>#region EQUAL CALCULATION
protected void Equal_Click(object sender, EventArgs e)
{
decimal output;
try
{
Expression a = new Expression(lblExpression.Text);
if (decimal.TryParse(a.Evaluate().ToString(), out output))
{
lblResult.Text = output.ToString();
lblExpression.Text = "";
}
}
catch (Exception)
{
lblExpression.Text = lblExpression.Text;
lblResult.Text = "Invalid Calculation";
}
}
#endregion
#region BUTTON FUNCTION
protected void Btn1_Click(object sender, EventArgs e)
{
lblExpression.Text = lblExpression.Text + button1.Text;
}
protected void Btn2_Click(object sender, EventArgs e)
{
lblExpression.Text = lblExpression.Text + button2.Text;
}
protected void Btn3_Click(object sender, EventArgs e)
{
lblExpression.Text = lblExpression.Text + button3.Text;
}
protected void Btn4_Click(object sender, EventArgs e)
{
lblExpression.Text = lblExpression.Text + button4.Text;
}
protected void Btn5_Click(object sender, EventArgs e)
{
lblExpression.Text = lblExpression.Text + button5.Text;
}
protected void Btn6_Click(object sender, EventArgs e)
{
lblExpression.Text = lblExpression.Text + button6.Text;
}
protected void Btn7_Click(object sender, EventArgs e)
{
lblExpression.Text = lblExpression.Text + button7.Text;
}
protected void Btn8_Click(object sender, EventArgs e)
{
lblExpression.Text = lblExpression.Text + button8.Text;
}
protected void Btn9_Click(object sender, EventArgs e)
{
lblExpression.Text = lblExpression.Text + button9.Text;
}
protected void Btn0_Click(object sender, EventArgs e)
{
lblExpression.Text = lblExpression.Text + button0.Text;
}
#endregion
#region OPERATOR
protected void Decimal_Click(object sender, EventArgs e)
{
lblExpression.Text = lblExpression.Text + Decimal.Text;
}
protected void Plus_Click(object sender, EventArgs e)
{
lblExpression.Text = lblExpression.Text + Plus.Text;
}
protected void Minus_Click(object sender, EventArgs e)
{
lblExpression.Text = lblExpression.Text + Minus.Text;
}
protected void Divide_Click(object sender, EventArgs e)
{
lblExpression.Text = lblExpression.Text + Divide.Text;
}
protected void Multiply_Click(object sender, EventArgs e)
{
lblExpression.Text = lblExpression.Text + Multiply.Text;
}
#endregion
protected void Reset_Click(object sender, EventArgs e)
{
lblExpression.Text = "";
lblResult.Text = "0";
}
protected void Back_Click(object sender, EventArgs e)
{
string s = "";
if (lblExpression.Text.Length > 1)
{
s = lblExpression.Text;
s = s.Substring(0, s.Length- 1);
}
lblExpression.Text = s;
}
What I have tried:
I don't know where should i add