Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I dynamically populate a CheckedListBox?

I want to populate a CheckedListBox based on the items passed into a form's constructor (in this case, a List<int>).

My skeleton code for this is:

foreach (int platypus in listPlatypi)
{
    userFriendlyPlatypusName = ExpandFromPlatypusID(platypus);
    // I want to store a verbose string in an Item of the CheckedListBox, something like:
    // Item item = new Item(userFriendlyPlatypusName); // what data type should "Item" be?
     CheckedListBox1.Add(item);
}
like image 424
B. Clay Shannon-B. Crow Raven Avatar asked Jul 19 '12 15:07

B. Clay Shannon-B. Crow Raven


1 Answers

Were you looking for checkedListBox1.Items.Add(userFriendlyPlatypusName); ?

like image 123
keyr Avatar answered Sep 28 '22 04:09

keyr