Click here to Skip to main content
15,892,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my project i have many no of button..each button have some unique operation.. but I want count the how many button's are clicked and how many button's are not clicked, can you give me the coding for this?
Posted
Updated 19-Oct-10 7:56am
v4
Comments
Abhinav S 19-Oct-10 13:23pm    
Minor editing to make question more readable.

Create a dictionary and put every button name as the key of this dictionary. The value of the dictionary can be the count.

Now every time a button is clicked, find that button in the dictionary and increment the value of the dictionary by 1. You can get the count of the number of times any button was clicked by usig this dictionary.
 
Share this answer
 
Alternatively, use the Tag property of the Button and increment it each time it is clicked - saves the extra overhead of a Dictionary.
 
Share this answer
 

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