Trier une arraylist en visual basic

magicabdou Messages postés 8 Date d'inscription lundi 9 mars 2009 Statut Membre Dernière intervention 23 septembre 2010 - 3 mai 2009 à 14:23
PCPT Messages postés 13272 Date d'inscription lundi 13 décembre 2004 Statut Membre Dernière intervention 3 février 2018 - 3 mai 2009 à 16:41
bonjour
peut quelqu'un m'aider de trier une arraylist en considérant des valeurs Integer ??

1 réponse

PCPT Messages postés 13272 Date d'inscription lundi 13 décembre 2004 Statut Membre Dernière intervention 3 février 2018 47
3 mai 2009 à 16:41
salut,

le tableau de type est plus approprié
LIST(OF TYPE)

ainsi tu as juste a faire :
TALIST.SORT()

exemple :



    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'tableau
        Dim IntList As New List(Of Int32)

        'remplissage pour test
        IntList.Add(5)
        IntList.Add(4)
        IntList.Add(6)
        IntList.Add(10)
        IntList.Add(2)

        'affichage
        For Each i As Int32 In IntList
            Console.WriteLine(i.ToString)
        Next
        Console.WriteLine("------------------")

        'tri
        IntList.Sort()

        'affichage
        For Each i As Int32 In IntList
            Console.WriteLine(i.ToString)
        Next
    End Sub
<!-- Coloration syntaxique vb/vba/vb.net : http://charles.racaud.free.fr/code-syntaxing/ -->
Coloration syntaxique vb/vba/vb.net







++

<hr size="2" width="100%" />
Prenez un instant pour répondre à [sujet-SONDAGE-POP3-POUR-CS_769706.aspx ce sondage] svp 
0
Rejoignez-nous