
Here’s a function that will remove duplicate items in a array. The code is for VB.net.
The code:
Function RemoveDuplicates(ByVal initialArray As String())
Dim i As Integer
Dim j As Integer
Dim newArray(0) As String
For i = 0 To UBound(initialArray)
For j = 0 To UBound(initialArray)
If Not initialArray(i) = "" Then
If Not j = i Then
If initialArray(i) = initialArray(j) Then
initialArray(j) = ""
End If
End If
End If
Next
Next
j = 0
For i = 0 To UBound(initialArray)
If Not initialArray(i) = "" Then
ReDim Preserve newArray(j)
newArray(j) = initialArray(i)
j += 1
End If
Next
Return newArray
End Function
More articles you may find interesting...