Guest User

Untitled

a guest
Aug 16th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. running on CheckedListBox and check what in the file
  2. AA
  3. BB
  4. CC
  5. DD
  6.  
  7. private void CheckEveryOther_Click(object sender, System.EventArgs e) {
  8. // Cycle through every item and check every other.
  9.  
  10. // Set flag to true to know when this code is being executed. Used in the ItemCheck
  11. // event handler.
  12. insideCheckEveryOther = true;
  13.  
  14. for (int i = 0; i < checkedListBox1.Items.Count; i++) {
  15.  
  16. // here you need to compare with that string....
  17. checkedListBox1.SetItemCheckState(i, CheckState.Indeterminate);
  18. else
  19. checkedListBox1.SetItemChecked(i, true);
  20. }
  21. }
  22.  
  23. insideCheckEveryOther = false;
  24. }
  25.  
  26. string myStr = "CC";
  27. for (int it = 0; it < checkedListBox1.Items.Count; it++)
  28. {
  29. checkedListBox1.SetItemChecked(
  30. it, myStr.Contains(checkedListBox1.Items[it].ToString()));
  31. }
Add Comment
Please, Sign In to add comment