Цитата:
Сообщение от Максон
Код:
procedure TForm2.addbtnClick(Sender: TObject);
var
i:Integer;
begin
strngrd1.RowCount:=0;
strngrd1.RowCount:=strngrd1.RowCount+1; //Добавление строки
for i:=1 to (strngrd1.RowCount+1) do
begin
if strngrd1.Cells[0,i]='' then
begin
strngrd1.Cells[1,i]:=edt1.Text;
strngrd1.Cells[2,i]:=edt2.Text;
strngrd1.Cells[3,i]:=edt3.Text;
strngrd1.Cells[4,i]:=cbb1.Text;
Exit;
end;
end;
end;
end.
|
Ты сначала кол-во строк обнуляешь, а потом добавляешь... На что тут можно расчитывать?