int num = 0;
for (int i = 0; i < this.grdnian.Items.Count; i++)
{
if ((this.grdnian.Items[i].Cells[0].Controls[1] as CheckBox).Checked == true)
{
num = num + 1;
}
}
请问这段代码是什么意思 as checkBox 的意思是什么
for (int i = 0; i < this.grdnian.Items.Count; i++)
{
if ((this.grdnian.Items[i].Cells[0].Controls[1] as CheckBox).Checked == true)
{
num = num + 1;
}
}
请问这段代码是什么意思 as checkBox 的意思是什么
{
num = num + 1;
}
-------------------------
如果这个选择框 被选择 num +1;
这个是导出程序 。
this.grdnian.Items[i].Cells[0].Controls[1]
获得的对象是Control,Control是没有checked属性的,为了使用Checked属性,我们需要将它转换成CheckBox类型。所以就as CheckBox了。