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 8364995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:33:34+00:00 2026-06-09T12:33:34+00:00

I am working on combo box, i am refresh the combo box values ,

  • 0

I am working on combo box, i am refresh the combo box values , first i am deleting all values and then re populating it. But it is not working. The code duplicates the values in combo box which is creating problem. Here is my Code.

    for (int i = 0; i < updateCombo.Items.Count; i++)
    updateCombo.Items.RemoveAt(i);

    //----------- Now Adding New Values --------
    updateCombo.Items.Add("Select an option . . .");

    SqlCommand command = new SqlCommand(Queries.qry9, connection);
    SqlDataReader reader = command.ExecuteReader();

Kindly please help me in fixing this problem.

  • 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-09T12:33:35+00:00Added an answer on June 9, 2026 at 12:33 pm

    Not sure why this would happen- but if Items.Count comes back as 0 then your loop won’t remove any of the existing contents from the items list and you’ll get duplicates.

    have you tried just clearing all the contents of the list regardless using:

    updateCombo.Items.Clear(); 
    

    It saves you having to iterate through them all, removing them one by one anyway.

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

Sidebar

Related Questions

why this code is not working .... I want to binding the combo box
I'm working with a data grid that contains a Combo Box Column, but editing
I have a combo box and a string array that holds all the values
I've created a custom HTML combo box. Everything's working good except Webkit browsers (Chrome
I am working on a wpf application, when using Combo Box control i am
I have a dynamic combo box which has the URL as the value. I
I have a combo box CBS_DROPDOWNLIST control filled with numeric values. I'd like for
I wanted the category_list function value to be inside my combo box but it's
I have a combo box on a WinForms app in which an item may
I have the following combo box which sets the number of images displayed per

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.