Board index » delphi » Delete a row in a TStringGrid

Delete a row in a TStringGrid

Does anybody know how can I delete a row in a TStringGrid?

Thanks in advance,

Luis Quental

 

Re:Delete a row in a TStringGrid


Quote
Luis Quental wrote in message <38BBE9E7.84E87...@fnmail.com>...
>Does anybody know how can I delete a row in a TStringGrid?

>Thanks in advance,

>Luis Quental

To delete row 2

  with StringGrid1 do
  begin
    for i := 2 to RowCount -1 do Rows[i-1] := Rows[i];
    RowCount := RowCount -1;
  end;

Regards.
Peter

Re:Delete a row in a TStringGrid


In article <38BBE9E7.84E87...@fnmail.com>, Luis Quental <lquen...@fnmail.com>
writes:

Quote
>Does anybody know how can I delete a row in a TStringGrid?

DeleteRow is a protected method of TStringGrid. Type-cast your stringgrid to a
descendant of TCustomGrid :-

type // in interface clause
  TDeleteRowCG = class(TCustomGrid);

then

  TDeleteRowCG(MyStringGrid).DeleteRow(2);  // delete the third row

Alan Lloyd
alangll...@aol.com

Other Threads