Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9231345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:02:34+00:00 2026-06-18T06:02:34+00:00

I know how to remove a single checkedItem from checkedlistbox . But now, I

  • 0

I know how to remove a single checkedItem from checkedlistbox. But now, I want to remove all the checked items in one go.

I tried this:

foreach (var item in List_Frente.CheckedItems)
            {
                List_Frente.Items.Remove(item);
            }

But as you probably know, it gives me an error,saying that, List that this enumerator is bound to has been modified. An enumerator can only be used if the list does not change. How may I remove all checkeditems with a single click ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:02:35+00:00Added an answer on June 18, 2026 at 6:02 am

    you could do something like this:

    foreach (var item in List_Frente.CheckedItems.OfType<string>().ToList())
    {
        List_Frente.Items.Remove(item);
    }
    

    If you want to write it all in one line:

    List_Frente.CheckedItems.OfType<string>().ToList().ForEach(List_Frente.Items.Remove);
    

    This only works if your items are of the same type, of course. Looks still crude, though.

    Edit-Explanation:
    ToList() creates a new list and thus, the original CheckedItems list can be changed, as the enumerator now enumerates our newly created list, not the original. The OfType<string>() is only there because we need something to call ToList() on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anybody know how to remove all the indexes from database ?
How would I remove a view from this dialog? I know I can remove
I know this question has been asked before, but I've tried everything I could
Is it possible in a single hit to remove all columns from a datagrid?
Does anybody know how to remove a line from a textfile. I'm looking for
Does anyone know how to remove Treeitems from a Treechildren node in ZK? I
i want to know how to remove underline in display listview in android, can
I'd like to know how to remove the background grid from asp.net charts, I
I know 'dequeue' and 'enqueue' for Queues (remove and add respectively), but what is
When I try to remove the last row from a single column data frame,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.