Click here to Skip to main content
15,924,195 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
protected void ButtonAdd_Clicked(object sender, EventArgs e)
   {

a = Convert.ToInt32(txtResult.Text);
txtResult.Text = "";
}

C#
protected void ButtonEqual_Clicked(object sender, EventArgs e)
   {

       b = Convert.ToInt32(txtResult.Text);
       txtResult.Text = "";

       c = a + b;
       txtResult.Text += c;


}


Iam using this code but it is only to Add two values but how to add multiple values like windows8 calculator
Posted
Comments
Sinisa Hajnal 15-Sep-15 9:20am    
Google it. It is not as simple problem as it seems. For example, you have to consider what happens if user enters 2 + 4*5 - 12*2. you have to evaluate multiplication before sums.

For just sums, you need an array which you will sum on ButtonEqual_Click

Good luck

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900