将项目从CheckedListBox复制到ListBox [英] Copy items from CheckedListBox to ListBox
本文介绍了将项目从CheckedListBox复制到ListBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将CheckedItems从CheckedListBox
复制到Listbox
,但是我做错了.
I'm trying to copy the CheckedItems from a CheckedListBox
to a Listbox
, but I am not getting it right.
我尝试过
Listbox.Items.Add(checkedlistbox.CheckedItems);
但这只能给我一个(收藏)
but that only gives me a (collection)
有人可以共享很多代码吗? :D
Does anyone have a great line of code to share? :D
推荐答案
这应该有效:
foreach(var Item in checkedlistbox.CheckedItems)
Listbox.Items.Add(Item);
用var替换字符串,因此它也适用于非字符串类型.
replaced string with var so it works with non-string types too.
这篇关于将项目从CheckedListBox复制到ListBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文