更新时间:2023-11-16 23:00:40
要在ListView
中进行多项选择,您必须设置ListView的属性为true.然后使用 SelectedItems
属性,该属性返回SelectedListViewItemCollection
然后迭代此集合以获取每个子项目的Text
属性
For multiple selection inListView
you have to set theMultiSelect
property of ListView to true. Then use theSelectedItems
property, which returnsSelectedListViewItemCollection
Then iterate this collection to get theText
property of each sub item
'In the form load event set
CAE_ListView.MultiSelect=True
'Iterate the selected items
Dim Msg as string=""
For Each sITEM as ListViewItem In CAE_Listview.SelectedItems
Msg &= sITEM.Subitems(1).Text & VbCrLf
Next
MessageBox.Show(Msg)