Deleting a selected row via another click in TStringGrid using delphi

I know this is easy to you but once again, this is article it's my archive, but if you think this i'll be your solution, why not? i'll share it.

using dbgrid may be easy with deleterow command, but you know in string grid does not have that command. and now with this little function can delete current row or selected row.

enjoyed!..


procedure DeleteCurrentRow(Grid: TStringGrid);
var
i: Integer;
begin
for i := Grid.Row to Grid.RowCount - 2 do
Grid.Rows[i].Assign(Grid.Rows[i + 1]);
Grid.RowCount := Grid.RowCount - 1;
end;

procedure TfrmDoAbsen.StringGrid1DblClick(Sender: TObject);
begin
DeleteCurrentRow(StringGrid1);
end;

example i have table string grid with double click i'll delete it current row :


so for result :