我用stringgrid做输入界面,怎样根据第二列某个单元格输入以后,第五列相应的单元值也相应改变
for row:=1 to DataInputStringGrid.RowCount-1 do
begin
if DataInputStringGrid.Cells[2,row]='' then
break;
end;
DataInputStringGrid.Cells[5,Row]:= floattostr(strtofloat(DataInputStringGrid.Cells[2,Row])*StrToFloat(Edit12.text));
for row:=1 to DataInputStringGrid.RowCount-1 do
begin
if DataInputStringGrid.Cells[2,row]='' then
break;
end;
DataInputStringGrid.Cells[5,Row]:= floattostr(strtofloat(DataInputStringGrid.Cells[2,Row])*StrToFloat(Edit12.text));
with DataInputStringGrid do
if Col = 2 then
Cells[5,Row]:= floattostr(strtofloat(Cells[2,Row])*StrToFloat(Edit12.text));
DataInputStringGrid.Col 当前列
DataInputStringGrid.Row 当前行
还有,注意StringGrid中的行和列是从0开始的!