|
-
May 1st, 2008, 09:31 PM
#1
How can I make a label display how many times a button is hit?
I have a button and a label. I want to press the button and display on the label the total of the times pressed multiplied by $5.
For example, I press the button 3 times and it displays in the label $15.
Below is what I have so far....
private void button1_Click(object sender, EventArgs e)
{
label1.Text = "0";
int count = System.Convert.ToInt32(label1.Text);
count++;
label1.Text = count.ToString();
}
It displays "1" and allows me to hit the button only once....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|