Ver Mensaje Individual
  #7  
Antiguo 16-12-2010
Avatar de rgstuamigo
rgstuamigo rgstuamigo is offline
Miembro
 
Registrado: jul 2008
Ubicación: Santa Cruz de la Sierra-Bolivia
Posts: 1.646
Reputación: 17
rgstuamigo Va por buen camino
Pues usando el evento OnClick de un boton y teniendo un edit para meter los datos pues se puede hacer algo así:
Código Delphi [-]
procedure TForm1.Button2Click(Sender: TObject);
Var a : Double;
     b : Int64;
     c : String;
begin
    a:=StrToFloat(Edit1.Text);// Obtengo el valor Float del texto del Edit en mi varible "a"
    b:=Round(a);// Hago el redondeo y obtengo dicho valor en mi varible "b"
    c:=IntToStr(b);// hago la conversión de Entero a String
    ShowMessage(c);//muestro el valor redondeado final
end;

O así tambien(sin usar variables) >
Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage(IntToStr(Round(StrToFloat(Edit1.Text))));
end;
Saludos...
__________________
"Pedid, y se os dará; buscad, y hallaréis; llamad, y se os abrirá." Mt.7:7
Responder Con Cita