1个回答
2013-07-01
展开全部
首先确定 listview1.MultiSelect = true添加几条测试数据 Public Sub additems()
ListView1.Items.Add("TXT1")
ListView1.Items.Add("TXT2")
ListView1.Items.Add("TXT3")
ListView1.Items.Add("TXT4")
End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
additems()
End Sub 下面试删除的代码 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
For Each item As ListViewItem In ListView1.SelectedItems
ListView1.Items.Remove(item)
Next
End Sub
ListView1.Items.Add("TXT1")
ListView1.Items.Add("TXT2")
ListView1.Items.Add("TXT3")
ListView1.Items.Add("TXT4")
End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
additems()
End Sub 下面试删除的代码 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
For Each item As ListViewItem In ListView1.SelectedItems
ListView1.Items.Remove(item)
Next
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询