As far as I understand, a Gremlin character was in a folder name; it is not a Sort trouble.
But you stop knowing what the folder is ACTUALLY called when you put the names into an array and sort it.
What is in this sorted array are strings which may no longer match the names of the folders.
So if you create a folderitem from the array, you get an invalid item.
Using Rick’s examples
You find the names of all the folders in “some place”
They are
La sorcière de la rue mouffetard
La chèvre de Monsieur Seguin
Something happens to these names when you read them - incorrect encoding, who knows, but what goes into the array is
La sorcière de la rue mouffetard
La chėvre de Monsieur Seguin //note I changed the diacritical here visually
You sort this, and you get
La chėvre de Monsieur Seguin
La sorcière de la rue mouffetard
Now, you work through this list alphabetically.
When you say
dim f as folderitem = Comics_folder.child (Page_Names(0))
You get a folderitem that is invalid because it is using the wrong name.
But if you sorted an array of folderitems, you would be able to say
for x as integer = 0 to folderitems.lastindex
dim f as folderitem = folderitems(x)
//use it
and that would work because the folderitem itself is still pointing to the actual folderitem you found.
I understand that you are confused by SortWith. It’s hard to follow.
Maybe look at the other sorting method
You create this method
function SortbyFileNames(a as folderitem,b as folderitem)
If a.filename > b.filename Then Return 1
If a.filename > b.filename Then Return -1
Return 0
end function
And sort the array of folderitems with
Folderitems.sort (AddressOf SortbyFileNames)