Changing how a ListBox displays an object.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dave Rudolf

    Changing how a ListBox displays an object.

    Hi all,

    I have a System.Windows. Forms.ListBox object that I am putting objects into.
    These objects are of custom types that I am defining. The list box displays
    each object by its class name -- not exactly usable :). So what I would like
    is to control the text that is displayed. Apparently, overridding the
    ToString method does not work. So what is the trick?

    I know that in Java, you can simply create a custom renderer that will
    control how an object is displayed. Is there a similar thing in C#?

    Dave.


Working...