如何获取复选框列表的值(未选中或未选中) [英] How do I get the value (not check or unchecked) of a checkboxlist
本文介绍了如何获取复选框列表的值(未选中或未选中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Winform应用程序,正在通过一个复选框列表进行检查,以查看所检查的内容.如果已选中,则我需要知道它的值成员或值属性是什么,因为在绑定复选框列表时已将其分配.
I'm working on a winform app and am interating through a checkboxlist to see what's checked. If it's checked, i need to know what it's value member or value property is because I assigned it when I bound the checkbox list.
我怎么能得到那个?
这就是我现在拥有的:
for (int i = 0; i < clbIncludes.Items.Count; i++)
if (clbIncludes.GetItemCheckState(i) == CheckState.Checked)
{
//need the values of the checked checkbox here
}");
推荐答案
foreach(object itemChecked in checkedListBox1.CheckedItems)
{
MyItem item = itemChecked as MyItem;
if (item != null)
{
// use item...
}
}
MSDN 参考.
这篇关于如何获取复选框列表的值(未选中或未选中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文