Hi,
I'm using a ListBox to display objects of various classes. Most clases
are derived from a base class of mine. If I override ToString in these
classes, the listbox displays what I want.
BUT
I have another class that is derived from LinkedList.
Overriding ToString in this one does not give the expected result,
instead "(Collection)" is displayed in the ListBox.
(To clarify, writing out a string like
WriteLn("MyClass: " + myClassObj);
DOES give the expected result, so the ToString override is in place, it
is just not called when adding the object to the LB)
I can get around this by using the DisplayMember property, but it
annoys me that ToString works for some classes but not for others.
So, is there a reason why overriding ToString in
MyClass : LinkedList<Something> seems to do nothing when adding it to
the ListBox?
Thanks,
Mac
Lloyd Dupont - 31 Jul 2005 16:41 GMT
I guess it's just ListBox which behave differently for collection
sorry no solution....

Signature
There are 10 kinds of people in this world. Those who understand binary and
those who don't.
> Hi,
>
[quoted text clipped - 22 lines]
> Thanks,
> Mac