publicvoid checkAllState(bool check) { for (int i =0; i <this.checkedListBox1.Items.Count; i++) { this.checkedListBox1.SetItemChecked(i, check); } }
publicstring GetTags() { string tags=""; //for (int i = 0; i<checkedListBox1.Items.Count; i++) //{ // if (checkedListBox1.GetItemChecked[i]) // { // tags += checkedListBox1. // } //} foreach (object itemChecked in checkedListBox1.CheckedItems) { // Use the IndexOf method to get the index of an item. //MessageBox.Show("Item with title: \"" + itemChecked.ToString() + "\", is checked. Checked state is: " + checkedListBox1.GetItemCheckState(checkedListBox1.Items.IndexOf(itemChecked)).ToString() + "."); tags += itemChecked.ToString(); } return tags; }