Uncheck checked item in a checkedlistbox using button control

In this blog we will know how to uncheck checked item in a checkedlistbox using button control.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

 
namespace Uncheck_checkeditem_checkedlistbox
{
   
public partial class Form1 : Form
   
{
       
public Form1()
       
{
           
InitializeComponent();
       
}
       
private void Form1_Load(object sender, EventArgs e)
       
{
           
checkedListBox1.Items.Add("Raj");
           
checkedListBox1.Items.Add("Ravi");
           
checkedListBox1.Items.Add("Rahul");
           
checkedListBox1.Items.Add("Rajesh");
       
}       
        private void btn_Uncheck_Click(object sender, EventArgs e)
       
{
           
while (checkedListBox1.CheckedIndices.Count > 0)
           
{
               
checkedListBox1.SetItemChecked(checkedListBox1.CheckedIndices[0], false);
           
}
       
}
   
}
}

Ebook Download
View all
Learn
View all