Lunasoft
Messages postés75Date d'inscriptionsamedi 28 juin 2008StatutMembreDernière intervention16 août 2011
-
30 avril 2011 à 15:38
f0xi
Messages postés4205Date d'inscriptionsamedi 16 octobre 2004StatutModérateurDernière intervention12 mars 2022
-
2 mai 2011 à 22:39
Salut!
Ma question est vraiment objective.
Comment faire pour avoir un nombre décimal.
Dans les codes ci-bas, je reçois un nombre final comme ceci par exemple: 5000,00
Et alors, comment faire pour avoir ceci: 5.000,00 au lieu de 5000,00
Je le fais personnellement avec Quick Report ou autres générateurs d'état avec ceci: #,###,###.00
Merci,
Étudiant
Delphi le revolutionnaire, Delphi le Conquérant
var
dotAndComa: TFormatSettings;
begin
dotAndComa.decimalSeparator := ',';
dotAndComa.thousandSeparator := '.';
S := format('%.2f',[value], dotAndComa);
// S retournera : X.XXX.XXX,XX
end;
f0xi
Messages postés4205Date d'inscriptionsamedi 16 octobre 2004StatutModérateurDernière intervention12 mars 202235 1 mai 2011 à 18:41
@caribensila : hahahaha ouai pas mal!
@Lunasoft:
l'idéal pour ce genre de truc :
procedure TForm1.EditFloatChange(Sender: TObject); // assigné à Edit1.onChange et Edit2.onChange
var A,B : extended;
begin
if TryStrToFloat(Edit1.text, A) and TryStrToFloat(edit2.text, B) then
begin
resultat.Caption := format('%n', [A * B]);
end
else
resultat.Caption := '?';
end;