Just thinking. I remember a while ago, there was a problem with some of the TList methods when you would override the Compare method. Apparently the built in function would also use Compare, but would expect it to work in its default behavior. You could try replacing Compare with its alternate version and see if the problem disappears.
If you're not sure how the alternative version works, here's a small example.
If you're not sure how the alternative version works, here's a small example.
SuperStrict Type MyType Field z:Int 'We'll sort on the z field Method New() 'will fill the z field with a random number on creation z = Rand(1,50) End Method 'The funtion you make must be in the form of int(object,object) 'It should return 0 if both objects are equal, <0 if Object2 is greater and >0 if Object1 is greater Function CompareFunc:Int(o1:Object,o2:Object) Return MyType(o1).z - MyType(o2).z 'The objects need to be cast to the proper type End Function End Type Local List:TList = CreateList() 'create the list For Local i:Int = 1 To 20 'Populate the list List.AddLast(New MyType) Next For Local o:MyType = EachIn List 'Print the list before sorting Print o.z Next Print 'empty line 'You must call Sort with the parameters filled in. The first is Ascending (True) 'or Descending (False). The second points to the Compare function you created earlier List.Sort(True,MyType.COmpareFunc) For Local o:MyType = EachIn List 'Print the sorted list Print o.z Next