我怎样才能通过表单上的所有复选框迭代? [英] How can I iterate through all checkboxes on a form?
本文介绍了我怎样才能通过表单上的所有复选框迭代?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有有许多动态生成的复选框的形式。在运行时,我怎么能透过他们每个人重复这样我就可以得到他们的价值和ID?
解决方案
的foreach(控制this.Controls C)
{
如果(c是复选框)
{
//做的东西在这里]
}
}
I have a form that has many dynamically generated checkboxes. At runtime, how can I iterate through each of them so I can get their value and IDs?
解决方案
foreach(Control c in this.Controls)
{
if(c is CheckBox)
{
// Do stuff here ;]
}
}
这篇关于我怎样才能通过表单上的所有复选框迭代?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文