add this procedure on your form
procedure RemoveRowColStringGrid(StringGrid: TStringGrid;In this example we will use the event OnKeyDown of StringGrid
RowCol: boolean; Which: integer);
var
i: integer;
begin
if RowCol= True then
begin
for i := StringGrid.Row to StringGrid.RowCount - 1 do
begin
StringGrid.Rows[i] := StringGrid.Rows[i + 1];
end;
StringGrid.RowCount := StringGrid.RowCount - 1;
end
else
begin
for i := StringGrid.Col to StringGrid.ColCount - 1 do
begin
StringGrid.Cols[i] := StringGrid.Cols[i + 1];
end;
StringGrid.ColCount := StringGrid.ColCount - 1;
end;
end;
procedure Form1.StringGrid1.KeyDown(Sender: TObject; var Key: Word;Shift: TShiftState);beginif key = VK_DELETE then //if key is deletebeginRemoveRowColStringGrid("Your StringGrid",
"True to remove row, False to remove col",
"Index of the row you want to remove");
end;end;