ListView Sorting

This is a discussion on ListView Sorting within the Windows Programming forums, part of the Platform Specific Boards category; I am adding items to listview at runtime. Thats OK. But I want to list them as adding sequence. I ...

ListView Sorting

I am adding items to listview at runtime. Thats OK. But I want to list them as adding sequence. I tried to add them backward via "for" circle but this time an unhandled exception occur. I am adding list items from a dynamic array, then calling "addtolist" procedure then when turning from proc. deleting the array. But while delete command that exception occur. Interesting because if I would add to list from zero to increasing number, no problem. But if I would add them top to zero index then after returning from listing, deleting the array is a nightmare.
I hope I could explain good. What can I do?