Control one item check in CheckedListBox

Here is a small code snippet for maintaining the checkedlist box control with only one checks.

Problem:

   I want to maintain only one checks in my checked list box in windows forms. But checked list box holds the property of allowing multiple checks. How can I control ,one item check in checked list box in c#

Solution:

private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
{

       CheckedListBox.CheckedIndexCollection checkedIndices = checkedListBox1.CheckedIndices;


             if (checkedIndices.Count > 0 && checkedIndices[0] != e.Index)

         { 
                      checkedListBox1.SetItemChecked(checkedIndices[0], false);

           } 
 } 
  
Cheers,
Venkatesan Prabu .J 
Head, KaaShiv InfoTech.
http://www.kaashivinfotech.com/
Next Recommended Reading Unique Array Items In C#