c# - Add only checked items to a new list -
im having problems. have checkedlistbox 40 names. want add names checked new list. seem have problems , if loop this. anyone?
if understand correctly, seems there might method of checkedlistbox this: http://msdn.microsoft.com/en-us/library/system.windows.forms.checkedlistbox.checkeditems.aspx
you can iterate through collection ever want like:
foreach(object itemchecked in checkedlistbox1.checkeditems) { //deal each itemchecked object }
or cast straight list
list<sometypeusedfortheitems> checkeditems = checkedlistbox1.checkeditems.cast<sometypeusedfortheitems>().tolist()
Comments
Post a Comment