adding checkeditems into an arraylist

juggernot

Well-known member
Joined
Sep 28, 2006
Messages
173
Programming Experience
Beginner
This is what I want my code to do :
On Buttonclick
For every item in a checkedlistbox, add the items text to an arraylist(as a string).

I can already do it like this, though I do not know if this adds the items as strings:
arraylist1.add(me.checkedlistbox1.items)
arraylist2.add(me.checkedlistbox2.items)

I'm just wondering if adding all the items at the same time would cause trouble later. For instance, when doing a for each statement or using the .contains method.
 
Last edited:
upon further testing, I have figured out that that adding the items as indicated previously doesn't work.
 
Try this:
VB.NET:
arraylist1.AddRange(CheckedListBox1.CheckedItems)
 
When I did that, it gave me an error that had something to do with serilization. I use that to save and load my array to a file. I kinda gave up on the checkedlistbox, and changed to a single select listbox, which is easier to manage.
 
Perhaps got something to do with what items you put in CheckedListBox control, I used string items which worked just fine. (as always :) everything I do work splendidly)
 
Back
Top