C# checkedListBox 全选与反选。

麻烦提供源码,谢谢.

第1个回答  2011-12-09
//全选
for (int i = 0; i < CheckBoxList1.Items.Count; i++)
{
CheckBoxList1.Items[i].Selected = true;
}

//反选
for (int i = 0; i < CheckBoxList1.Items.Count; i++)
{
if(CheckBoxList1.Items[i].Selected)
CheckBoxList1.Items[i].Selected = false;
else
CheckBoxList1.Items[i].Selected = true;

}
相似回答