Routine to clear checkbox from listview C#

Asked

Viewed 540 times

1

I created a small routine to clean the checkboxes that are in my listview in C# windows Forms. But this routine is not unchecking them. I wonder if I wrote something wrong or why it doesn’t work. Code:

    private void limpacheck()
    {
        foreach (ListViewItem item in lsvRecebeGrupoLayout.CheckedItems)
        {
            item.Checked = false;

        }
    }

1 answer

1


Change Checkeditems to Items

private void limpacheck()
{
    foreach (ListViewItem item in lsvRecebeGrupoLayout.Items)
    {
        item.Checked = false;

    }
}
  • It worked brother, but he cleaned all the lines he has scheduled at check. It would be possible to keep the information of the lines and only uncheck the check?

  • I don’t know about that, sorry

  • All right rs, solved the problem that is most important. Thanks anyway!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.