473,387 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

List box DataSource question

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
Nov 20 '05 #1
3 1694
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
-----------

"SStory" <Th*******@TAKEOUTTHISSPAMBUSTERsofthome.net> wrote in message
news:eR**************@TK2MSFTNGP11.phx.gbl:
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


--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.3 - Release Date: 6/18/2004
Nov 20 '05 #2
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

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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
-----------

"SStory" <Th*******@TAKEOUTTHISSPAMBUSTERsofthome.net> wrote in message
news:eR**************@TK2MSFTNGP11.phx.gbl:
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


--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.3 - Release Date: 6/18/2004

Nov 20 '05 #3
Hi,

Sure the listbox item is an object not a string.

Ken
---------------

"SStory" <Th*******@TAKEOUTTHISSPAMBUSTERsofthome.net> wrote in message
news:#u**************@TK2MSFTNGP11.phx.gbl:
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

"Ken Tucker [MVP]" <HYPERLINK
"mailto:vb***@bellsouth.net"vb***@bellsouth.ne t> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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
-----------

"SStory" <HYPERLINK
"mailto:Th*******@TAKEOUTTHISSPAMBUSTERsofthome.ne t"TheStorys@TAKEOUTTHISSPA
MBUSTERsofthome.net> wrote in message
news:eR**************@TK2MSFTNGP11.phx.gbl:

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

--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.3 - Release Date: 6/18/2004


--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.3 - Release Date: 6/18/2004
Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: BobforeApples | last post by:
Hi All, I was trying to apply databinding to a custom collection as in the MSDN Magazine article found in the August, 2005 issue. After converting the code in the article to C# and applying it to...
5
by: Vigneshwar Pilli via DotNetMonster.com | last post by:
string connectionString1 = "server=(local); user=sa;password=sa; database=sonic"; System.Data.SqlClient.SqlConnection dbConnection1 = new System.Data.SqlClient.SqlConnection(connectionString1);...
2
by: Water Cooler v2 | last post by:
What am I missing here. I bind a drop-down list in ASP.NET placed on a web form to a DataReader. The binding is done at run-time and not at design time. Here's the code I write to bind the list: ...
11
by: Zorpiedoman | last post by:
The problem is this: I have a list box. I set an array list as the datasource. I remove an item from the array list. I set the listbox datasource to nothing. I set the listbox datasource to...
0
by: WebBuilder451 | last post by:
I has a sp used as a datasource bound to a dropdown list. It has a column i need to set another value on change. The value is not the value property of the DDL. how can i get to the value in the...
11
by: dave18 | last post by:
Hello all! I found a solution to my original question, but there's still so much I don't understand about it, I thought I'd give this forum a try. At the very least, maybe it will help someone...
8
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
I'm trying to get a list of SQL Server Instances thru a VB.NET application. I have tried GetDataSource and SMO. I have also tried using ListSQLSvr.exe from...
7
by: Ciri | last post by:
Hi all, I've a problem with a datagridview. The data source of the control is a List<t> where t is type of a class I've created. The class (Person) has some properties like Name, Surname and so on....
4
by: sree078 | last post by:
I've a list of items which I bound to multiple combo boxes. In the due course in the code...I had to add an item into one combo box...but I don't want it to be reflected into any other combo...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.