Code: Select all
Dim tmp_col As Collection[] = New Collection[]
tmp_col.Add([
"name": "toto4",
"test": "quattre"
])
tmp_col.Add([
"name": "toto6",
"test": "six"
])
tmp_col.Add([
"name": "toto1",
"test": "un"
])
tmp_col.Add([
"name": "toto3",
"test": "trois"
])
Code: Select all
Public Function ColSort(col As Collection[], ColKey As String, trie As Integer) As Collection[]
Dim tmp_col As Collection[] = New Collection[col.count]
Dim tmp_ar As String[] = New String[]
For i As Integer = 0 To col.count - 1
tmp_ar.Add(col[i][Colkey] & " (" & i & ")")
Next
tmp_ar.Sort(trie)
For i = 0 To tmp_ar.count - 1
tmp_col[i] = col[CInt(Split(tmp_ar[i], " ()", "", True)[1])]
Next
Return tmp_col
End
Code: Select all
tmp_col = ColSort(tmp_col, "name", gb.Ascent)
Olivier