Cameron Kloot

hi,
how would i be able to remove all the checked items from a checkedlistbox i have tried all i could think of but nothing yet.
thanks




Re: Visual C# Express Edition checked list box question

jrboddie

If you mean uncheck all checked items, do this:

Code Snippet

private void button1_Click(object sender, EventArgs e)

{

for (int ix = 0; ix < checkedListBox1.Items.Count ; ix++)

{

checkedListBox1.SetItemChecked(ix, false);

}

}

If you mean remove the checked items from the list, do this:

Code Snippet

private void button2_Click(object sender, EventArgs e)

{

int ix = 0;

while (ix < checkedListBox1.Items.Count)

{

if (checkedListBox1.GetItemChecked(ix))

{

checkedListBox1.Items.RemoveAt(ix);

}

else

{

ix++;

}

}

}





Re: Visual C# Express Edition checked list box question

Cameron Kloot

thats it thanks