已检查列表框的语法

时间:2013-08-06 01:58:18

标签: vb.net

我有checklistbox 1和2.

我需要能够同时根据每个checkedlistbox中选择的项目运行一些XML代码。

语法是什么样的:

For each item in checkedboxlist1.selectedItems

' run my XML code

Next

1 个答案:

答案 0 :(得分:2)

对于Web开发(ASP.NET),请执行以下操作:

For Each item As ListItem In checkedboxlist1.Items
    If item.Selected Then
        ' Run your XML code here
    End If
Next

对于Windows开发(WinForms),请执行以下操作:

For Each item In checkedboxlist1.CheckedItems
    ' Run your XML code here
Next