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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:51:47+00:00 2026-06-08T08:51:47+00:00

I have a combobox with objects of Foo type, here is the Foo class:

  • 0

I have a combobox with objects of Foo type, here is the Foo class:

public class Foo
{
    public string name { get; set; }
    public string path { get; set; }
}

The Foo.name is the displayed text in the combobox and Foo.path is the value of the selected option.

I want to delete an option from the combobox after some operation I made.

I’ve tried these ways:

  • 1

    comboBox2.Items.Remove(@comboBox2.Text);  
    
  • 2

    comboBox2.Items.Remove(@comboBox2.SelectedValue.ToString());  
    
  • 3

    Foo ToDelete = new Foo();
    ToDelete.name = @comboBox2.Text;
    ToDelete.path = @comboBox2.SelectedValue.ToString();
    comboBox2.Items.Remove(ToDelete); 
    

Nothing works for me. : / How to do this?

UPDATE

This is how I’m initializing my combobox:

    string[] filePaths = Directory.GetFiles(sites.paths[comboBox1.SelectedIndex]);

        List<Foo> combo2data = new List<Foo>();

        foreach (string s in filePaths)
        {
            Foo fileInsert = new Foo();
            fileInsert.path = s;
            fileInsert.name = Path.GetFileName(s);
            combo2data.Add(fileInsert);
        }

        comboBox2.DataSource = combo2data;
        comboBox2.ValueMember = "path";
        comboBox2.DisplayMember = "name";
  • 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-08T08:51:49+00:00Added an answer on June 8, 2026 at 8:51 am

    comboBox2.Items.Remove(comboBox2.SelectedValue); will only remove from the combobox, not from the datasource bound to the combobox. You may remove it from the datasource and re-bind the datasource.

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

Sidebar

Related Questions

I have a ComboBox bound to a collection of objects defined as this. public
I have an ObservableCollection<Person> object. The Person objects have Name and Type properties, where
I have a list of custom objects: say Fruits with two string properties Name
I have a WPF ComboBox: <ComboBox ... ItemsSource={Binding Source={StaticResource viewModel}, Path=getItems, Mode=OneTime} x:Name=combobox SelectionChanged=combobox_SelectionChanged>
I have a ComboBox with a list of objects bound to it. Currently i
I have a ComboBox with a label function like this one: private function fieldLabelFunction(item:Object):String
i have combobox in datagrid (sourse in mysql (web)) how i can get value
Say I have an Employee class and one of its properties is of type
I've got a problem with VB6. I have a form with several ComboBox objects
I have a windows application project with a list of objects and combobox. How

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.