对Listbox VB.net中的每个选定项执行操作

时间:2011-06-06 15:12:52

标签: vb.net visual-studio-2010

我正在使用大型列表填充列表框。然后,用户可以选择从该列表中选择多个项目。然后,我想对所选项目进行一些操作。

我无法弄清楚如何仅对突出显示的选项执行操作。

'I have tried all combinations of

For each Listbx.SelectedItems.ToString in ListBx.Items.ToString
For each Listbx.SelectedItem in Listbx.Items 
'etc, etc

''Performing actions here but it is still doing it with all entries

Next

1 个答案:

答案 0 :(得分:4)

For Each selecteditem As [Object] In Listbx.SelectedItems
    //Your code on each item
Next