Ver Mensaje Individual
  #5  
Antiguo 20-06-2015
Avatar de nlsgarcia
[nlsgarcia] nlsgarcia is offline
Miembro Premium
 
Registrado: feb 2007
Ubicación: Caracas, Venezuela
Posts: 2.206
Reputación: 21
nlsgarcia Tiene un aura espectacularnlsgarcia Tiene un aura espectacular
alejozd,

Cita:
Empezado por alejozd
...'###########0.##' en el FormatCurr me retorna solo el 0 y necesito el 0.00...'###########0.00' no me tomaría los decimales...


Revisa este código:
Código Delphi [-]
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
   N1, N2, N3 : Currency;
   S  : String;
   MsgUsr : String;

begin

   N1 := 578.12;
   N2 := 578.00;
   N3 := 0;

   S := FormatCurr('###########0.00', N1);
   MsgUsr := Format('N1 = %s',[S]);
   MessageDlg(MsgUsr,mtInformation,[mbOK],0);

   S := FormatCurr('###########0.00', N2);
   MsgUsr := Format('N2 = %s',[S]);
   MessageDlg(MsgUsr,mtInformation,[mbOK],0);

   S := FormatCurr('###########0.00', N3);
   MsgUsr := Format('N3 = %s',[S]);
   MessageDlg(MsgUsr,mtInformation,[mbOK],0);

end;

end.
El código anterior en Delphi 2010 sobre Windows 7 Professional x32, Muestra un ejemplo de la función FormatCurr en el cual se mantiene el formato definido en la función, como se muestra en la siguiente imagen:



Revisa esta información:
Espero sea útil

Nelson.
Responder Con Cita