hi, just a quick question
can somebody please tell me how to restrict the output of the code below to 2 decimal places.
VolumeCalc.Caption := FloatToStr(StrToFloat(EngineSizeVal.Text) / 2 / StrToFloat(CylNumVal.Text));
thx for the help.
hi, just a quick question
can somebody please tell me how to restrict the output of the code below to 2 decimal places.
VolumeCalc.Caption := FloatToStr(StrToFloat(EngineSizeVal.Text) / 2 / StrToFloat(CylNumVal.Text));
thx for the help.
Use the Format command like this:
VolumeCalc.Caption := Format('%.2f',[StrToFloat(EngineSizeVal.Text) / 2 / StrToFloat(CylNumVal.Text)]);
Sub Xero
thx for the help works great!
i have just changed my Label to a EditBox.. and the above code doesnt seem to work at all, just wondering how to limit an edit box to 2 decimal places.
VolumeCalc.Text := FloatToStr(StrToFloat(EngineSizeVal.Text) / 2 / StrToFloat(CylNumVal.Text));
It should be exactly the same. Format returns a string, so there's no difference in applying the result to an Editbox or a label.
What exactly is the problem?
Sub Xero
dont matter, had a bit too much to drink last night :/
format is working fine, sorry about wasting your time asking again.
thx for the help
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.