我有4个列表框,我只能删除一个列表框的副本,但问题是因为列表框1,2,3,4的索引已连接,当点击按钮删除时,它必须删除该项目。< / p>
Private Sub btnRemDup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRemDup.Click
Dim items1(ListBox1.Items.Count - 1) As Object
ListBox1.Items.CopyTo(items1, 0)
ListBox1.Items.Clear()
ListBox1.Items.AddRange(items1.AsEnumerable().Distinct().ToArray())
Dim items2(ListBox2.Items.Count - 1) As Object
ListBox2.Items.CopyTo(items2, 0)
ListBox2.Items.Clear()
ListBox2.Items.AddRange(items2.AsEnumerable().Distinct().ToArray())
Dim items3(ListBox3.Items.Count - 1) As Object
ListBox3.Items.CopyTo(items3, 0)
ListBox3.Items.Clear()
ListBox3.Items.AddRange(items3.AsEnumerable().Distinct().ToArray())
End Sub