Populating a CheckedListBox with a System.Collections

  • Thread starter Thread starter Chibi
  • Start date Start date
C

Chibi

Hello!

I'm back again with another problem.

First of all, thank you to Jacob for helping me understand
a bit more about NNTP commands.

So now the problem:

I have a collection of potentially thousands of items. I
would like to load this collection and populate it in a
Windows.Forms.CheckedListBox, while at the same time,
store the items in a database (which I already have
connected).

The first step is VERY basic but yet I'm still having
problems. How can I point the CheckedListBox to the
collection? Right now, the collection is an ArrayList but
I can change it to anything else on a whim, if anyone
suggests it.

Please let me know what you suggest. Thank you very much
to everyone out there!
 
Chibi,

You should be able to set the DataSource property on the CheckedListBox
to the ArrayList. Then, to display the contents, you will have to set the
DisplayMember property to the name of the property that you want to be used
when displayed in the listbox. Also, you can set the ValueMember property
to the value that is returned from the listbox as well (instead of relying
on a display name).

Hope this helps.
 
Back
Top