如何收集选中列表框项目的选定索引 [英] how to collect the selected indices of the items of the checked list box
本文介绍了如何收集选中列表框项目的选定索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
这是一个问题,我想动态地收集选中的列表框控件中各项的选定索引....
thnx
hi all ,
Here is the question , i want to collect the selected indices of the items in the checked list box control dynamically ....
thnx
推荐答案
对其进行迭代并构建一个仅包含已检查内容的int列表.假设已经没有财产了,这会让我感到惊讶.
我想您住的地方没有Google.我知道了,所以我找到了:
http://msdn.microsoft.com/en-us/library/system.windows.forms.checkedlistbox.checkedindexcollection.aspx [ ^ ]
但是,您肯定会获得完整的Visual Studio吗?它具有智能.打 .然后您会在该对象上获得方法列表.当然,"CheckedItems"是自记录文件吗?
Iterate over them and build a list of ints that contains only the ones that are checked. Assuming there''s no property for that already, which would surprise me.
I guess you don''t have google where you live. I do, so I was able to find this:
http://msdn.microsoft.com/en-us/library/system.windows.forms.checkedlistbox.checkedindexcollection.aspx[^]
However, surely you get the full visual studio ? It has intellisense. Hit . and you get a list of methods on the object. Surely ''CheckedItems'' is self documenting ?
我相信您是在要求以下内容:
I believe you were asking for this:
private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
{
if (e.NewValue == CheckState.Checked)
{
MessageBox.Show(e.Index.ToString());
}
}
这篇关于如何收集选中列表框项目的选定索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文