Ver Mensaje Individual
  #3  
Antiguo 08-03-2005
Avatar de Ohcan
[Ohcan] Ohcan is offline
Miembro Premium
 
Registrado: ago 2004
Ubicación: Madrid (España)
Posts: 119
Reputación: 20
Ohcan Va por buen camino
Lightbulb

Hola alfredosg19
¿Lo que quieres es que el contenido del edit sea numérico (integer o float)?
Si es así, puedes definirte una función de este estilo:
Código Delphi [-]
function ComprobarNumerico(Texto: String; Key:Char): Char;
begin
  if Key <> Char(VK_BACK) then
    begin
      try
        if Key in[',','.'] then Key := DecimalSeparator;
        StrToFloat(Texto + Key + '0');
      except
        Result:=#0;
        Exit;
      end;
    end;
  Result := Key;
end;

Estoy escribiendo de memoria...
A esta funcion la llamas desde el evento onKeyPress del Edit de esta forma:
Código Delphi [-]
Key := ComprobarNumerico(MiEdit.Text; Key:Char);

Espero que te sirva...
__________________
La violencia es el último recurso del incompetente. (Salvor Hardin)
Responder Con Cita