How can I dynamically populate a CheckedListBox?

B. Clay Shannon picture B. Clay Shannon · Jul 19, 2012 · Viewed 15.8k times · Source

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);
}

Answer

keyr picture keyr · Jul 19, 2012