Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1.     // First show the index and check state of all selected items.
  2.     foreach(int indexChecked in checkedListBox1.CheckedIndices) {
  3.         // The indexChecked variable contains the index of the item.
  4.         MessageBox.Show("Index#: " + indexChecked.ToString() + ", is checked. Checked state is:" +
  5.                         checkedListBox1.GetItemCheckState(indexChecked).ToString() + ".");
  6.     }
  7.  
  8.     // Next show the object title and check state for each item selected.
  9.     foreach(object itemChecked in checkedListBox1.CheckedItems) {
  10.  
  11.         // Use the IndexOf method to get the index of an item.
  12.         MessageBox.Show("Item with title: \"" + itemChecked.ToString() +
  13.                         "\", is checked. Checked state is: " +
  14.                         checkedListBox1.GetItemCheckState(checkedListBox1.Items.IndexOf(itemChecked)).ToString() + ".");
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement