VB.NET - Recupere les valeurs distinct Array

Résolu
Bonjour,

Alors voilà, j'ai un tableau de structure de la forme

Public Structure struct
Dim type1 As String
Dim type2 As String
Dim type3 As String
Dim type4 As String
End Structure

et un tableau du type de cette structure:

Public machin() As struct

J'aimerai récuperer toutes les valeurs distincts de type4, par exemple :)

J'ai bien trouvé le
dim arr as array = machin.distinct.toarray
Mais il prend la premiere colonne :s

Help \o/

2 réponses

  1. Bon bin, Okay, je vais faire comme ça !

    Merci beaucoup, ça fonctionne nikel :)
    1. Salut,

      Tu peux toujours le faire manuellement !

      Dim arr As New ArrayList
      Dim Compteur As Int64 = 0
      Dim Texte As String = String.Empty
      
      For Compteur = 0 To (machin.LongCount - 1)
          If Not (arr.Contains(machin(CType(Compteur, Int32)).type4)) Then
              arr.Add(machin(CType(Compteur, Int32)).type4)
          End If
      Next
      
      For Compteur = 0 To (arr.Count - 1)
          Texte = Texte & CType(arr(CType(Compteur, Int32)), String) & vbCrLf
      Next
      
      MessageBox.Show(Texte)
      '
      


      Cdt

      Lupin