ListBox Item Objects: what is displayed?

  • Thread starter Thread starter Peteroid
  • Start date Start date
P

Peteroid

I'm going to be using a ListBox in my managed C++ application, and have a
question. Why are the Items you Add to a ListBox in the form of generic
Object*'s? I believe a ListBox displays a table of selectable options via
multiple lines (or columns) of TEXT, so why doesn't Add merely take a
String* ? How does it know what to display (i.e., the text of each Item
listing) with a generic Object* (or do all Object's have some Text property
ListBox knows to display to represent it)? Put more to the point, if I Add
an Item which ISN'T a String*, what does the ListBox display?

Thanks in advance! : )

[==Peteroid==]
 
You should look up DisplayMember and ValueMember, which are listbox
properties. I have never used it myself but you can use that to control what
is displayed in the listbox.

mosimu
 
Thanks, I will :)

[==Peteroid==]

mosimu said:
You should look up DisplayMember and ValueMember, which are listbox
properties. I have never used it myself but you can use that to control
what
is displayed in the listbox.

mosimu

Peteroid said:
I'm going to be using a ListBox in my managed C++ application, and have a
question. Why are the Items you Add to a ListBox in the form of generic
Object*'s? I believe a ListBox displays a table of selectable options via
multiple lines (or columns) of TEXT, so why doesn't Add merely take a
String* ? How does it know what to display (i.e., the text of each Item
listing) with a generic Object* (or do all Object's have some Text
property
ListBox knows to display to represent it)? Put more to the point, if I
Add
an Item which ISN'T a String*, what does the ListBox display?

Thanks in advance! : )

[==Peteroid==]
 
Back
Top