Tuesday, 14 February 2017

Checkbox Edit

for(int i = 0; i < checkedListBox1.Items.Count; i++)
 {
  checkedListBox1.SetItemChecked(i, false);//First uncheck the old value!
  //
  for (int x = 0; x < values.Length; x++)
  {
           if (checkedListBox1.Items[i].ToString() == values[x])
           {
               //Check only if they match!
               checkedListBox1.SetItemChecked(i, true);
           }
  }
}

No comments:

Post a Comment