Routine to clear listview checkbox C #

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 did not work. Code:

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

        }
    }
    
asked by anonymous 11.10.2017 / 14:58

1 answer

1

Change CheckedItems for Items

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

    }
}
    
11.10.2017 / 15:10