How to remove a selected rows?


I am using AdvStringGrid with Delphi 7. I have a very large grid. I wish to select a few cells and remove the rows which contain those cells. I used the "removeSelectedRows" and it works. 
But if I remove the last 3 rows and afterwards add 3 new rows, the new rows contain the data from the deleted rows as if they were hidden and not deleted. Maybe for the Undo function, it works this way. How can I remove the rows permanently?

For performance reasons, the content of these rows is not cleared.

If you add new rows later and need to be sure these are clear,you can call grid.ClearRows() or alternatively, you can also clear selected rows before removing.


How is the performance improved if I have to delete the content in the rows?  
Does grid.ClearRows() require the index of the row as the parameter? If yes, Is there a way to get the index of the selected rows?

If you would remove 1000 rows in a grid with 100 columns that would be 100.000 cells to clear. As not in all cases this is strictly needed, it is not done by default for performance reasons.

To get the index of selected rows depends on your selection mode. When this is just goRowSelect = true in grid.Options, you could use grid.ClearSelection;