标签:单击 cte str count int ted i++ emc item
正确的代码:
string selectedItem = string.Empty; for(int i=0; i < checkedListBox1.Items.Count; i++) { if (checkedListBox1.GetItemChecked(i)) { selectedItem = selectedItem + " " + checkedListBox1.Items[i].ToString(); } }
以下代码只能选择最后单击的那项
string selectedItem = string.Empty; for(int i=0; i < checkedListBox1.SelectedItems.Count; i++) { selectedItem = selectedItem + " " + checkedListBox1.SelectedItems[i].ToString(); }
checked 针对勾选 selected针对单击选择的项 一定要注意哦!
标签:单击 cte str count int ted i++ emc item
原文地址:http://www.cnblogs.com/zqyo2000z/p/7392337.html