Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I add multiple lines to a TStringGrid cell?

38 views
Skip to first unread message

hack...@gmail.com

unread,
Jul 22, 2014, 4:22:04 PM7/22/14
to
I have a very simple program with one form and one button (see code below). This program will populate each cell of the StringGrid with the column and row number of the cell. How can I modify this to add multiple lines of strings in each cell? Ultimately, I'd like to use a StringGrid to display some driver scheduling information. I will be exracting data from a database table and populating the StringGrid based on a date (like a Calendar form). The problem I'm having is getting more than one line of text in a cell of a StringGrid.

----------------------------------------------------------------

procedure TForm1.Button1Click(Sender: TObject);
var
C, R: integer;
begin
StringGrid1.RowCount := 3;
StringGrid1.ColCount := 4;
for C := 0 to 4 do
for R := 0 to 2 do
StringGrid1.Cells[C, R] := Format('C: %d, R: %d', [C, R]);
end;

end.
0 new messages