Visual Basic how to remove duplicate values in an array

Jonathan Brotto 286 Reputation points
2020-01-12T05:02:33.777+00:00

In Visual Basic how to remove duplicate values in an array?

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
37,136 questions
0 comments No comments
{count} vote

Accepted answer
  1. Parag Ghorpade 76 Reputation points
    2020-01-12T07:33:44.993+00:00

    Try this :

    Setting:
    
    Dim number As Integer
    Dim num As String
    Dim al As New ArrayList()
    If Not (al.Contains(number)) Then
        al.Add(number)
    End If
    
    Getting:
    
    For Each number In al
        num = number.ToString()
    Next
    

    Reference:
    https://stackoverflow.com/questions/6185149/vb-net-how-to-remove-duplicates-from-an-array


1 additional answer

Sort by: Most helpful
  1. Dave Patrick 426.4K Reputation points MVP
    2020-01-12T14:07:26.557+00:00

    Visual basic is not currently supported here on QnA. They're actively answering question in dedicated forums here.
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vbgeneral

    --please don't forget to Accept as answer if the reply is helpful--


    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows Server] Datacenter Management

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.

    1 person found this answer helpful.
    0 comments No comments