如何为每个选中的复选框设置计数 [英] how to set a count for the each selected checkbox

查看:416
本文介绍了如何为每个选中的复选框设置计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何为每个复选框设置一个计数并计算被选中的次数(例如)我必须创建一个程序,使用户能够为候选人投票,并且必须向每个候选人添加计数如果U可以

how can i set a count for each checkbox and count the number of times it has been selected (eg) i have to create a PROGRAM that will enable user to vote for a candidate and it has to add a count to each candidate that has been selected please help me if U can

推荐答案

我不会那样做,请帮助我.我将在候选对象中有一个计数器,当用户单击提交"时该计数器将更新(如果选中了他的框,则添加一个).但是,嘿,就是我.

我也可以使用单选按钮,但是同样,也就是我.
I wouldn''t do it that way. I would have a counter in a candidate object that gets updated when user clicks submit (adds one if his box is checked). But hey, that''s just me.

I would also use radio buttons, but again, that''s just me.


从Checkbox继承一个新控件.添加一个要计数的属性,然后在每次选中该复选框时勾选该计数.
Inherit a new control from the Checkbox. Add a property to count, then tick that count up every time the checkbox is selected.


这篇关于如何为每个选中的复选框设置计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆