How can I create an array containing the checked items in a checkedlistbox using foreach loop (or any other way)?
I can't know the number of items in the list.
Assuming your using 3.5 or above..
object[] items = lb.CheckedItems.OfType<object>().ToArray();
And if you are adding a specific type of object to the CheckedListBox then you can replace object with the name of the class you use.