procedure TForm6.Button3Click(Sender: TObject);
var
  i:integer;
begin
   i:=stringgrid1.Row;
   stringgrid1.Rows[i].Delete(i);
end;
我想实现的是该行删除,而不是clear(不会中间出现空行)

解决方案 »

  1.   

    for i:=1 to StringGrid5.RowCount-1 do
          begin
            if  StringGrid5.Cells[1,i] = StringGrid4.Cells[0,Row] then
                begin
                  for j:=i to StringGrid5.RowCount-1 do
                   begin
                     StringGrid5.Cells[0,i] :=StringGrid5.Cells[0,i+1];
                     StringGrid5.Cells[1,i] :=StringGrid5.Cells[1,i+1];
                     StringGrid5.Cells[2,i] :=StringGrid5.Cells[2,i+1];
                     StringGrid5.Cells[3,i] :=StringGrid5.Cells[3,i+1];
                   end;
                  StringGrid5.RowCount:=StringGrid5.RowCount-1;
                end;
            end;用这种方法可以达到你的要求,是将StringGrid5中一行删除。
      

  2.   

    StringGrid5.Cells[1,i] = StringGrid4.Cells[0,Row]
    这句是什么意思?怎么会有5和4?
      

  3.   

    关注StringGrid是什么东东,学习