Delphi StringGrid column in uppercase

In Reply to: Delphi StringGrid column in uppercase

How do I set all text in upper case in a particular StringGrid column?

Answer

Here's a code example:

procedure TForm1.Button1Click(Sender: TObject);
var
  C, R: integer;
begin
  C := StringGrid1.Col;   // current column
  for R := 0 to StringGrid1.RowCount - 1 do
    StringGrid1.Cells[C, R] :=
      UpperCase(StringGrid1.Cells[C, R]);
end;

If the first row of the Delphi StringGrid is a fixed row, you probably don't want to set that one also in uppercase. Then you start from the second row, "row 1":

  ...
  for  R := 1  to StringGrid1.RowCount - 1 do
    ...