How do I code variables for a simple "running total" box without using an array?
IE: I have a "Points Earned" text box that the user inputs a value into. I have another output "Total Points Earned" box that keeps a running count of all points earned every time the user inputs a new value.
I've been doing this (which is obviously wrong):
//declare variables
decimal decPointsEarned = Convert.ToDecim al(txtPointsEar ned.Text);
decimal decTotalPointsE arned;
//run code
decTotalPointsE arned = decPointsEarned + decPointsEarned ;
//display code
lblTotalPointsE arned = decTotalPointsE arned.ToString( );
IE: I have a "Points Earned" text box that the user inputs a value into. I have another output "Total Points Earned" box that keeps a running count of all points earned every time the user inputs a new value.
I've been doing this (which is obviously wrong):
//declare variables
decimal decPointsEarned = Convert.ToDecim al(txtPointsEar ned.Text);
decimal decTotalPointsE arned;
//run code
decTotalPointsE arned = decPointsEarned + decPointsEarned ;
//display code
lblTotalPointsE arned = decTotalPointsE arned.ToString( );
Comment