PDA

Ver la Versión Completa : Error de Currency


Epunamun
05-12-2005, 22:45:56
Estoy manejando valores de monedas y nesecito hacer calculos y me sale error, de tipos ejemplo



var
a: Currency;
a1: Currency;
tot: Currency;
begin
a := strtoint(dbedit1.Text); //precio compra
a1 := strtoint(maskedit1.Text); //valor del cliente
tot := (a * a1);
maskedit2.Text := inttostr(tot);


Esto va a un procedimiento ayuda plz

marcoszorrilla
05-12-2005, 22:59:42
Prueba así:


procedure TForm1.Button1Click(Sender: TObject);
var
a : Currency;
a1 : Currency;
tot: Currency;
begin
a := strtoint(edit1.Text); //precio compra
a1 := strtoint(maskedit1.Text); //valor del cliente
tot:= (a * a1);
maskedit1.Text := FormatFloat(',0.00',tot);
end;


Además deberías utilizar Try...Except para cubrirte de valores incorrectos.

Un Saludo.

Epunamun
05-12-2005, 23:41:25
muchas gracias te pasaste