不计算选择单选按钮的次数 [英] count no of times a radio button is selected
本文介绍了不计算选择单选按钮的次数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
计算选择单选按钮的次数,并在文本框中显示ans。实际上我正在制作一个用于计票的投票软件我想要计算选择一个单选按钮的次数,它应该是静态的,这样每次刷新页面后点击按钮数据都会保留在那里。
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.
推荐答案
您可以尝试这样的事情:
You can try something like this:
public Form1()
{
InitializeComponent();
}
int rdbButtonChecked = 0;
private void button1_Click(object sender, EventArgs e)
{
if (radioButton1.Checked == true)
rdbButtonChecked++;
textBox1.Text = rdbButtonChecked.ToString();
}
这篇关于不计算选择单选按钮的次数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文