How to uncheck items from CheckListBox
If user have selected different number of items in CheckListBox; and if you want to reset the CheckListBox again; then you can achieve that from here.
How to Uncheck Checked Items from CheckListBox
CheckedListBox provides you the list of checkbox items so that user can select more than one options. But if you want to reset the CheckListBox you can do it.Code Explained:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace dns_uncheced_CheckList
{
public partial class Form1 : Form
{
IEnumerator enumCountry; //Enumerator declared
public Form1()
{
InitializeComponent();
}
private void btnReset_Click(object sender, EventArgs e)
{
//Getting checked items from the checkListBox into enumerator
enumCountry = checkedListBoxCountry.CheckedIndices.GetEnumerator();
int iCurrentCountry;
while (enumCountry.MoveNext() != false)
{
iCurrentCountry = (int)enumCountry.Current;
checkedListBoxCountry.SetItemChecked(iCurrentCountry, false);
lblMessage.Text = "MESSAGE: All checked items unchecked!";
}
}
}
}
this is help full to beginners