请参阅选中列表框中的项目名称

时间:2014-05-01 11:57:40

标签: vb.net visual-studio-2012

我可以通过索引

循环检查列表框中的所有项目

http://www.dotnetheaven.com/article/checkedlistbox-in-vb.net

Dim sb As New System.Text.StringBuilder
  For Each item In CheckedListBox1.SelectedItems
    sb.Append(item)
    sb.Append(" ")
  Next
  MessageBox.Show(sb.ToString())

但我只想检查是否通过布尔值和名称检查项目。

For Each item In CheckedListBox1.Items
        MsgBox(item.ToString)
    Next

循环他们..但我想要

item("myItem").checked?.selected属性?

请帮忙。

1 个答案:

答案 0 :(得分:0)

SelectedItems一样,选中的项目位于集合中:

For Each item  In CheckedListBox1.CheckedItems
    MessageBox.Show(item.ToString)
Next

还检查了项目的索引的CheckedIndicies集合。 NB CheckedItemsSelectedItems

不同