cs_tandoori
Messages postés13Date d'inscriptionjeudi 1 juillet 2004StatutMembreDernière intervention18 août 2004
-
26 août 2004 à 17:43
cs_dragon
Messages postés2336Date d'inscriptionsamedi 14 juillet 2001StatutMembreDernière intervention 5 mai 2009
-
26 août 2004 à 21:01
voila, j'ai un arraylist dans lequel je rajoute des items de type structure
je voudrais ensuite trier cet arraylist par un element de la structure en question, c'est possible?
cs_dragon
Messages postés2336Date d'inscriptionsamedi 14 juillet 2001StatutMembreDernière intervention 5 mai 20096 26 août 2004 à 20:22
oui, faut que tu le fabrique toi mêem par contre
tiens un exemple, dans le fond c'est pas complexe, tu trie le champ le plus important, si plus petit, oki, si plus grand on intervertie, si egal, on regarde le 2e champs le plus important et ainsi de suite
For i = 0 To UBound(EmployeeVar) - 1
If Not EmployeeVar(i).Employee.Visible Then
For j = i To UBound(EmployeeVar) - 2
EmployeeVar(j) = EmployeeVar(j + 1)
Next j
ReDim Preserve EmployeeVar(UBound(EmployeeVar) - 1)
End If
If EmployeeVar(i).jour > EmployeeVar(i + 1).jour Then
intervertir(i)
ElseIf EmployeeVar(i).jour = EmployeeVar(i + 1).jour Then
If EmployeeVar(i).heure.Entre > EmployeeVar(i + 1).heure.Entre Then
intervertir(i)
ElseIf EmployeeVar(i).heure.Entre = EmployeeVar(i + 1).heure.Entre Then
If EmployeeVar(i).heure.Sortie > EmployeeVar(i + 1).heure.Sortie Then
intervertir(i)
ElseIf EmployeeVar(i).heure.Sortie = EmployeeVar(i + 1).heure.Sortie Then
If EmployeeVar(i).level > EmployeeVar(i + 1).level Then
intervertir(i)
ElseIf EmployeeVar(i).level = EmployeeVar(i + 1).level Then
If EmployeeVar(i).job > EmployeeVar(i + 1).job Then
intervertir(i)
ElseIf EmployeeVar(i).level = EmployeeVar(i + 1).level Then
If EmployeeVar(i).nom > EmployeeVar(i + 1).nom Then
intervertir(i)
End If
End If
End If
End If
End If
End If
Next i
-------------------------------------------------
Dragon alias aussi Waxime mais bon, pas le gout de refaire un nouveau profil lol
-------------------------------------------------
cs_dragon
Messages postés2336Date d'inscriptionsamedi 14 juillet 2001StatutMembreDernière intervention 5 mai 20096 26 août 2004 à 20:42
c'est pas dur a faire un trie, c'est 5 lignes. pour une structure c'est un peu plus long, mais à la base c'est ça
je vais faire dequoi, attend un peu
-------------------------------------------------
Dragon alias aussi Waxime mais bon, pas le gout de refaire un nouveau profil lol
-------------------------------------------------
cs_dragon
Messages postés2336Date d'inscriptionsamedi 14 juillet 2001StatutMembreDernière intervention 5 mai 20096 26 août 2004 à 20:44
ah non, il y a pas d'index pour les différent type, donc je peux pas faire une fonction qui reçoi un tableau a trier et un tableau de structure
si, il y aurait une façon, mais ça ralentirais le code en maudit
-------------------------------------------------
Dragon alias aussi Waxime mais bon, pas le gout de refaire un nouveau profil lol
-------------------------------------------------
Vous n’avez pas trouvé la réponse que vous recherchez ?
cs_dragon
Messages postés2336Date d'inscriptionsamedi 14 juillet 2001StatutMembreDernière intervention 5 mai 20096 26 août 2004 à 21:01
compare si 2 object sont identiques
ça trie pas et tu peux pas lui dire quel champ regarder
ça fasi juste voir si c'est identique ou non
-------------------------------------------------
Dragon alias aussi Waxime mais bon, pas le gout de refaire un nouveau profil lol
-------------------------------------------------