![](/img/trans.png)
[英]how to add the values related to the items selected in checkedlistbox
[英]how to know if all items are selected in checkedlistbox
復選框名為“全選”。 當取消選中復選框列表中的任何項目時,將取消選中“全選”復選框,下面的代碼執行此工作。
但是當所有項目都在checkedlistbox中選中時,應該選中“全選”。
for (int i = 0; i < checkedListBox1.Items.Count; i++) {
if (!checkedListBox1.GetItemChecked(i))
checkBox1.Checked = false;
}
嘗試這樣的事情
if (checkedListBox1.CheckedItems.Count == checkedListBox1.Items.Count)
{
//your code goes here
}
嘗試這個:
if (checkedListBox1.CheckedItems.Count == checkedListBox1.Items.Count)
{
//your code goes here
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.