Hello!

I have Paradox table and TStringField. Trying to calculate its value: first

converting

string to double and making calculatons then convert result back to String,

but i get wrong results:

When value grows to 20 or more i get 24,03 or 24,01.

Is the problem in StrToFloat?.

I must use StringField, because user wants to type here string or Float

value.

Another question: I have FloatField in same table and making same

calculations like before

and wondering how to keep zeros after number. Example:

Program works like this:

1,25

1,5

1,75

2

Must be:

1,25

1,50

1,75

2,00

Code from DBEdit KeyDown event:

Max := 30.00;

Min := -30.00;

inc := 0.25;

case key of

VK_UP : begin

try

dbl := StrToFloat((fld as TStringField).Value);

except

on EConvertError do

dbl := 0;

end;

if dbl >= Max then dbl := Min;

dbl := dbl + inc;

(fld as TStringField).Value := FloatToStr(dbl);

end;

VK_DOWN : begin

try

dbl := StrToFloat((fld as TStringField).Value);

except

on EConvertError do

dbl := 0;

end;

if dbl <= Min then dbl := Max;

dbl := dbl + inc;

(fld as TStringField).Value := FloatToStr(dbl);

end;