如何在列表框中排序重复元素并将这些元素添加到另一个列表框中 [英] How Do I Sort Out The Repeating Element In A Listbox And Add Those Elements To Another Listbox
本文介绍了如何在列表框中排序重复元素并将这些元素添加到另一个列表框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Dim temp()As Integer = {1,2,2,3,4}
Dim i As Integer
For count = 0到temp.Count - 1
If(temp(i).ToString = temp(i + 1).ToString)然后
ListBox2.Items.Add( i)
结束如果
下一页
它显示我的错误,如索引超出界限。请帮帮我
解决方案
嗨Surajit,
也许你可以使用这样的东西:
Dim temp()As Integer = {1,2,2,3,4}
Dim i As Integer
For i = 0 to temp.Count - 2
if(temp(i)= temp(i + 1))然后
ListBox2.Items.Add(temp (i))
结束如果
下一页我
我希望这对你有用。
Dim temp() As Integer = {1, 2, 2, 3, 4}
Dim i As Integer
For count = 0 To temp.Count - 1
If (temp(i).ToString = temp(i + 1).ToString) Then
ListBox2.Items.Add(i)
End If
Next
It shows me error like index was out of boundary. Please help me out
解决方案
Hi Surajit,
maybe you can use something like this:
Dim temp() As Integer = {1, 2, 2, 3, 4}
Dim i As Integer
For i = 0 To temp.Count - 2
If (temp(i) = temp(i + 1)) Then
ListBox2.Items.Add(temp(i))
End If
Next i
I Hope this is useful for you.
这篇关于如何在列表框中排序重复元素并将这些元素添加到另一个列表框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文