I have a TStringGrid with 10 columns. Adding 500 lines to it takes about 2 seconds. Is this normal performance?
It seems a little slower to me.
I get data from a database query. If I scroll through the query but don’t write the results to StringGrid, the process takes about 100 ms, so it cannot slow down the database.
After adding rows, StringGrid's performance is great.
Here is the code I'm using
Grid.RowCount := Query.RecordCount; J := 0; while not Query.EOF do begin Grid.Cells[0,J]:=Query.FieldByName('Value1').AsString; Grid.Cells[1,J]:=Query.FieldByName('Value2').AsString; Grid.Cells[2,J]:=Query.FieldByName('Value3').AsString; // etc for other columns. Inc(J); Query.Next(); end;
The actual code is actually a bit more complicated (the columns of the table do not match the columns of the query), but the main idea
source share