Ver Mensaje Individual
  #2  
Antiguo 31-08-2006
Avatar de Enan0
Enan0 Enan0 is offline
Miembro
 
Registrado: may 2004
Ubicación: Argentina
Posts: 565
Reputación: 21
Enan0 Va por buen camino
Código Delphi [-]
procedure TPrincipal.ImporteKeyPress(Sender: TObject; var Key: Char);
var
   numeros: set of '0'..'9';
   i:integer;
begin
Try
   numeros:=['0'..'9'];
   i:=pos(',',importe.Text);
//Busca si se ingreso la coma  (para que te ingresen algo como esto 7.0.0)
   if (key ='.') and (i<0) then
      begin
         key:=',';
      end
   else
      if  not (key in numeros) and (key <> #8) then
         key:=#0;

//#8 es el backspace
except
end;
end;
Responder Con Cita