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
		{

		}
	}

 

 

USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.