Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Label berechnen...Komma (https://www.delphipraxis.net/99603-label-berechnen-komma.html)

Steven2 14. Sep 2007 16:10


Label berechnen...Komma
 
Hallo, ich möchte einen Wert mit 2 Nachkommastellen haben.
Bin ich mit Round auf der richtigen Spur?

Bei meinem Bespiel wird das Komma abgeschnitten.
Delphi-Quellcode:
 QRLabel14.caption:=floattostr(strtofloat(QRLabel14.caption) - strtofloat(QRLabel11.caption));

Freundliche Grüße
Steven

jfheins 14. Sep 2007 16:13

Re: Label berechnen...Komma
 
Guck die mal Delphi-Referenz durchsuchenFormat an ;)

dominikkv 14. Sep 2007 16:13

Re: Label berechnen...Komma
 
Delphi-Quellcode:
QRLabel14.caption := Format('%f', [44.5478554]);

Steven2 14. Sep 2007 16:31

Re: Label berechnen...Komma
 
Ich bin zu doof:
Delphi-Quellcode:
QRLabel14.caption:=Format('%f', [floattostr(strtofloat(QRLabel14.caption) - strtofloat(QRLabel11.caption)));
Wie geht das?
Hab hier zwar was gelesen, verstehe aber nur Bahnhof:
http://www.delphibasics.co.uk/RTL.asp?Name=Format

dominikkv 14. Sep 2007 16:34

Re: Label berechnen...Komma
 
als argument wird ein float erwartet:
Delphi-Quellcode:
QRLabel14.caption := Format('%f', [strtofloat(QRLabel14.caption) - strtofloat(QRLabel11.caption)]);

Steven2 14. Sep 2007 16:38

Re: Label berechnen...Komma
 
Danke...du hast mir sehr damit geholfen.
Freundliche Grüße
Steven


Alle Zeitangaben in WEZ +1. Es ist jetzt 23:16 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz