2009-01-03 90 views
1

我正在制作一个winform应用程序,并正在通过复选框列表来查看所检查的内容。如果选中,我需要知道它的值成员或值属性是因为我在绑定复选框列表时分配了它。如何获取复选框列表的值(不选中或未选中)

我该怎么做?

这是我现在有:

   for (int i = 0; i < clbIncludes.Items.Count; i++) 

       if (clbIncludes.GetItemCheckState(i) == CheckState.Checked) 
       { 
        //need the values of the checked checkbox here 
       }"); 

回答

2
foreach(object itemChecked in checkedListBox1.CheckedItems) 
{ 
    MyItem item = itemChecked as MyItem; 

    if (item != null) 
    { 
     // use item... 
    } 
} 

MSDN Ref

相关问题