怎么用foreach遍历CheckBoxList里的各项? 怎么用foreach遍历CheckBoxList里的各项? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 // cs_foreach.csclass ForEachTest{ static void Main(string[] args) { int[] fibarray = new int[] { 0, 1, 2, 3, 5, 8, 13 }; foreach (int i in fibarray) { System.Console.WriteLine(i); } }} lz是在说遍历CheckBoxList控件,楼上的是在访问数组lz可以使用for循环,比如: for (int n = 0; n < T1CheckBoxList.Items.Count; n++) { T1 += Convert.ToString(n) + ":" + Convert.ToString(Convert.ToInt32(T1CheckBoxList.Items[n].Selected)); if (n < T1CheckBoxList.Items.Count - 1) { T1 += "|"; } } foreach (CheckBox i in CheckBoxList) { .... } foreach (ListItem li in CheckBoxList1.Items) { if (li.Selected==true) { } } 楼主'System.Windows.Forms.CheckedListBox'未实现 'GetEnumerator'。故不可以用foreach呵呵用for 循环吧。 jc15271149(嘿咻) ( ) 信誉:86 Blog 2006-10-18 15:19:00 得分: 0 foreach (ListItem li in CheckBoxList1.Items) { if (li.Selected==true) { } }///////////////////////////////////可用,高见 ok,问题解决,真快呀爱死csdn了 url重写和生成静态页面问题 急求回答!! Xml轉DataTable問題 dt.rows.count问题 在页面中显示图片的问题(从数据库中取路径,在REPEATER中显示) 高手进来坐坐!! WriteMessage问题 政则初学习!!\ba和a有什么区别?? 如何获取系统真正的实际时间 跟着高手一步一步学习组件编程1:请教如何实现控件在页面上的显示属性(visible=true or false).. 新手问题~请看源程序~谁能我给我解释一下是怎么调用的? 公网上xmlhttp.open()不执行的问题 特殊字符问题
class ForEachTest
{
static void Main(string[] args)
{
int[] fibarray = new int[] { 0, 1, 2, 3, 5, 8, 13 };
foreach (int i in fibarray)
{
System.Console.WriteLine(i);
}
}
}
for (int n = 0; n < T1CheckBoxList.Items.Count; n++)
{
T1 += Convert.ToString(n) + ":" + Convert.ToString(Convert.ToInt32(T1CheckBoxList.Items[n].Selected));
if (n < T1CheckBoxList.Items.Count - 1)
{
T1 += "|";
}
}
{
....
}
{
if (li.Selected==true)
{
}
}
'System.Windows.Forms.CheckedListBox'未实现 'GetEnumerator'。故不可以用foreach
呵呵
用for 循环吧。
foreach (ListItem li in CheckBoxList1.Items)
{
if (li.Selected==true)
{
}
}///////////////////////////////////可用,高见