Click here to Skip to main content
15,883,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
count how many times a radio button is selected and ans is shown in a text box. Actually i am making a voting software for counting votes i wanna count how many times a radio button is selected and it should be static so that every time after refreshing my page by clicking button data stays there.
Updated 4-Sep-13 0:15am
Jameel VM 4-Sep-13 5:20am    
set a counter variable and increment by 1 whenever radio button click and set the counter value to textbox
Thanks7872 4-Sep-13 5:31am    
button or radio button?
Thanks7872 4-Sep-13 5:31am    
What would you do then? if there is option,do you want to proceed yes/no. If i change selection 100 times,than you want to display 100 in textbox?

1 solution

You can try something like this:

public Form1()
        int rdbButtonChecked = 0;

        private void button1_Click(object sender, EventArgs e)
            if (radioButton1.Checked == true)

            textBox1.Text = rdbButtonChecked.ToString();
Share this answer
Member 10231501 4-Sep-13 6:11am    
thnx for help but nothing is happening...
Christopher Kenis 4-Sep-13 6:19am    
Are you working on a webapplication?

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