General Setup

To cause the items in the CheckedListBox to be checked when you click them the first time, set the control's CheckOnClick property to True.

Clear All Items


	clbMyCheckedList.Items.Clear();

Clear Individual Items


	clbMyCheckedList.Items.RemoveAt(0);		//Specify index position

Add New Items


	clbMyCheckedList.BeginUpdate();		//Stop painting of the ListBox as items are added
	clbMyCheckedList.Items.Add("Entry 1", true);
	clbMyCheckedList.EndUpdate();

How Many Items Are Checked?


	count = clbMyCheckedList.CheckedItems.Count

Is Item Checked?


	for (Count = 0; Count < clbMyCheckedList.Items.Count; Count++)
	{
		if (clbMyCheckedList.GetItemChecked(Count))

Getting Item String


chkTagsList.>GetItemText(chkTagsList.Items[Count]);

Setting Checked State


	clbMyCheckedList.SetItemChecked(Count, true);
	clbMyCheckedList.SetItemCheckState(Count, CheckState.Indeterminate);

Select An Item


	clbMyCheckedList.SetSelected(index, true);

Causing value change on first click in a row

Set "Check on click" on

Item Value Changed


	private void clbIncludedGroups_ItemCheck(object sender, ItemCheckEventArgs e)
	{
		if (e.NewValue == System.Windows.Forms.CheckState.Checked)
		{

		}
		else
		{

		}
	}

 

 

Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published. Required fields are marked *