How to sort string grid?

I am a beginner in Delphi.
I got an assignment and i need help.
How can i do a sorting string grid?
Please help me.
Thanks for the help and i'm sorry for my bad english...


  • Unfortunately there's no ready-made code to do this. You need to do this virtually. I have tried before, and it's really tough. Basically, you need to create your own type of object storing information about each record, and temporarily store each record (Row) of the grid in one of these objects and temporarily store those objects in a list. The caption of each list item shall be the string of whatever field you wish to sort. Then, you sort that list. Then, you go through that list again one by one and re-load those objects and their data back into the grid.

    Please let me know if you need more detailed code.
  • I'm attaching a little project of mine to demonstrate how to sort a string grid, as I mentioned in an earlier post. It's part of a much bigger program, but stripped down for an example for you.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion