It fairly straight forward. To load the box you add to the Items list and
include it the item is checked by default or not. The code looks like
this
clbVendorShows.Items.Add("E:", False)
You will need to get a list of all the drives in the system and customize
the statement with what you want it to list. You will have one of theses
statements for each item in the checkedlistbox.
Note: If you want to reselect an item, the use;
clbVendorShows.Items.Add("C:", True)
To read back you use
isChecked = clbVendorShows.GetItemChecked(i)
where i is the index into the items.
Here's some code I just used to step through all the items in the box to
see if they where checked.
For i = 0 To clbVendorShows.Items.Count - 1
isChecked = clbVendorShows.GetItemChecked(i)
' do some other things here based on what I found ...
Next
There are other ways to reach what is checked, in my case I needed to
know what was check and what wasn't. Read up on the documentation in VS,
on the collections available. There is one for "checked" items that will
return all the items that were checked. That would be handy for when you
just care about what was selected and not what wasn't selected.
Bernie
"dm1608" <dm****@spam.net> wrote in
news:OM**************@TK2MSFTNGP05.phx.gbl:
I'm not sure how to use the Checked Listbox control and how to iterate
thru it