I wrote this code for sorting a list of classes Variante by the field Variante.Descrizione
After sorting the list gblVarianti isn't sorted!
Someone can help me?
In attach, the class Variante.
Thanks in advance,
Loris
After sorting the list gblVarianti isn't sorted!
Someone can help me?
In attach, the class Variante.
Thanks in advance,
Loris
B4X:
Public gblVarianti As List
...
Private Sub SortVarianti()
Dim n As Int, i As Int, j As Int
n = gblVarianti.Size - 1
Dim V1 As Variante
Dim V2 As Variante
Dim Vtemp As Variante
For i = (n - 1) To 0 Step -1
For j = 0 To i
V1 = gblVarianti.Get(j)
V2 = gblVarianti.Get(j + 1)
If V1.Descrizione.CompareTo(V2.Descrizione) > 0 Then
Vtemp = V2
V2 = V1
V1 = Vtemp
End If
Next
Next
End Sub
Attachments
Last edited: