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

  • Home
  • SEARCH
  • 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 6203683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:57:29+00:00 2026-05-24T04:57:29+00:00

I am adding objects from classes which are derived from UserControl to a ComboBox

  • 0



I am adding objects from classes which are derived from UserControl to a ComboBox control. This is really helpful as I can access the necessary control directly from the combobox.

It all works fine EXCEPT for the fact that all ComboBox entries are empty strings (the derived UserControls behind it are fully accessible using selectedItem)…

The ComboBox uses DropDownList as its drop down style – but changing that doesn’t fix it.

A minimum working example displaying empty strings:

public class TestControl : UserControl {
    public override string toString(){
        return "Example";
    }
}

...
combobox.Items.Add(new TestControl());
...

When I call

combobox.Items.Add(new TestControl().ToString());

directly, the entry is “Example”.

Is this a bug in the ComboBox control or am I doing something wrong?
Thank you

  • 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-05-24T04:57:30+00:00Added an answer on May 24, 2026 at 4:57 am

    Odd, that should work. Another alternative would be to set the DisplayMember property of the combobox to a property on your TestControl:

    Typically, the representation of an object in the ComboBox is the
    string returned by that object’s ToString method. If you want to have
    a member of the object displayed instead, choose the member that will
    be displayed by setting the DisplayMember property to the name of the
    appropriate member.

    http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.items.aspx (in the remarks section)

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

Sidebar

Related Questions

I am adding objects (NSNumbers in this case) to an NSMutableArray and I wanted
I have a stateless, abstract base class from which various concrete classes inherit. Some
Hello all i'm turning objects on (adding the class .active) and off on a
I am dynamically adding an image to a canvas object which was working for
I have a script which contains two classes. (I'm obviously deleting a lot of
The general question is which module structure is more convenient when adding instances for
I have a host application that controls various factory classes which produce implementations of
I'm currently facing a performance problem with creating POCO objects from my database. I'm
I tried out hibernate mapping for domain classes in my application- which are Book,Author
I am trying to serialize some Linq objects using this code. private byte[] GetSerializedObj(object

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.