List box DataSource question

  • Thread starter Thread starter SStory
  • Start date Start date
S

SStory

For an owner drawn list box,

I have a collection that represents some graphics objects in my app.
I inherited the collection class from collectionbase.

It would be nice to somehow just set the lstbox.datasource=mycollection
and have it work, but this seemed to never work so I just run through my
collection and popualate the list.
This is a real waste because the collection contains classes that have one
property that is a bitmap. There won't be many of them but still this is
duplicating memory.

Anyone know a way to make a collection class that works normally and also
with a listbox?
Remember I owner draw each item.

Thanks,

Shane
 
Hi,

Try setting the displaymember in addition to the datasource. Remember
the displaymember can be any property in the class held in the
collection.

Ken
-----------
 
hmm..
The thing is. I have a class lets say
clsGraphicObject
and a collection class
colGraphicOjbect
inherits collectionbase

which has a list of clsGraphicObjects

I want to set listbox data source to this colGraphicObject's Items,
but also the result is not a string, but in clsGraphicObject, there is a
picture property that is a bitmap--that is what I want to display in the
listbox.

Will this still work?

Shane
 
Back
Top