Each time I click on button display sum
I am clicking on button which is equals to 5, i want the label to display updated number each time i click on button, so 1 button click = 5 on label, 2 button clicks = 10 on label, etc.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sam HobbsRank #107 · 20.5K reputationPosted Feb 20, 2012, 5:21 PM EST
Then your code will be more like this:
anteLabel.Text = number.ToString();
Note that that code does not show the one line that declares the number.
Sam HobbsRank #107 · 20.5K reputationPosted Feb 20, 2012, 4:20 PM EST
Think about it. Think about what is needed. It is extremely easy to do if you think about it. You will need a count of the nuber of times the button has been clicked. Each time the button is clicked, increment the count, then convert that count (multiply by 5) to the value you need to show. Then convert the value to a string and then set the button's Text property to that value. If you have any questions about that then please ask a specific question.
Prime bRank #2,035 · 712 reputationPosted Feb 20, 2012, 4:25 PM EST
And my question is this
private void chipBet5Button_Click(object sender, EventArgs e)
{
int number = +5;
anteLabel.Text = ""+number ;
}
each time I click chpBet5Button I want anteLabel.Text to display the number! So, as you can see, the number is equals to 5 with first click, but if I click it twice it just displays 5 again........ it doesn't add 5 to number second time, it kind of resets!
Prime bRank #2,035 · 712 reputationPosted Feb 20, 2012, 5:29 PM EST