如何遍历表单上的所有复选框? [英] How can I iterate through all checkboxes on a form?
本文介绍了如何遍历表单上的所有复选框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个包含许多动态生成的复选框的表单.在运行时,我如何遍历它们中的每一个,以便获取它们的值和 ID?
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屋!
查看全文