Ver Mensaje Individual
  #8  
Antiguo 07-12-2010
Avatar de marcoszorrilla
marcoszorrilla marcoszorrilla is offline
Capo
 
Registrado: may 2003
Ubicación: Cantabria - España
Posts: 11.221
Reputación: 10
marcoszorrilla Va por buen camino
He hecho algunos cambios porque detecté un fallo si se empieza tecleando un 0.
Código Delphi [-]
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
 if not (Key in ['0'..'9',#8])  then
  begin
     Beep;
     Key:=#0;
  end;
end;

procedure TForm1.Edit1Change(Sender: TObject);
begin
  if length(Edit1.Text) > 0 then
  begin
   If Edit1.Text[1]='0' then
   begin
   ShowMessage('El primer valor no puede ser cero.');
     if Length(Edit1.text) > 1 Then
     Edit1.Text:=Copy(Edit1.Text,2,Length(Edit1.Text))
     else
     Edit1.Text:='';
   end;
  end;
end;
Un Saludo.
__________________
Guía de Estilo de los Foros
Cita:
- Ça c'est la caisse. Le mouton que tu veux est dedans.
Responder Con Cita