比如同一行中的某一cell的值等于另外 - 个cell与一个数的积
用
for i:=0 to stringgrid1.rowcount - 1 do
stringgrid1.cells[1,i]:=floattostr(strtofloat(stringgrid1.cells[2,i]))*4
会报错,
用
stringgrid1.cells[1,i]:=floattostr(strtofloatdel(stringgrid1.cells[2,i],0))*4的时候通过,结果是错的比如同一行中的某一cell的值等于另外 - 个cell与一个数的积应该怎样做?
用
for i:=0 to stringgrid1.rowcount - 1 do
stringgrid1.cells[1,i]:=floattostr(strtofloat(stringgrid1.cells[2,i]))*4
会报错,
用
stringgrid1.cells[1,i]:=floattostr(strtofloatdel(stringgrid1.cells[2,i],0))*4的时候通过,结果是错的比如同一行中的某一cell的值等于另外 - 个cell与一个数的积应该怎样做?
for i:=0 to stringgrid1.rowcount - 1 do
stringgrid1.cells[1,i]:=floattostr(strtofloat(trim(stringgrid1.cells[2,i])))*4
说 ''is not floating point value
for i:=0 to stringgrid1.rowcount - 1 do
stringgrid1.cells[1,i]:=floattostr((strtofloat(stringgrid1.cells[2,i]))*4);
//试试这个:
for i:=0 to stringgrid1.rowcount - 1 do
if trim(stringgrid1.cells[2,i])<>'' then
stringgrid1.cells[1,i]:=floattostr(strtofloat(trim(stringgrid1.cells[2,i])))*4
else stringgrid1.cells[1,i]:='某值'