Ver Mensaje Individual
  #7  
Antiguo 17-05-2007
Avatar de anubis
anubis anubis is offline
Miembro
 
Registrado: mar 2007
Posts: 863
Reputación: 20
anubis Va por buen camino
gracias marcos, era sencillo cuestion de aplicar la logica .

Pero me seguia sin funcionar he tenido que hacer esto:
Código Delphi [-]
procedure Tfhabitacion.fecharegistroChange(Sender: TObject);
var
fechahoy:tdate;
begin
fechahoy:=now;
  if fecharegistro.Date<=fechahoy then
    begin
      fecharegistro.date:=fechahoy;
    end;
  if fechasalida.date<=fecharegistro.date+1 then
    fechasalida.date:= fecharegistro.date+1;
diasestancia.caption:=inttostr(daysbetween(fechasalida.date,fecharegistro.date));
end;

porque sino no me lo realiza, si le bajo a la fecha de salida dias hasta llegar a ser igual que la de entrada no me hace el if.

gracias de nuevo

lo unico que no me queda claro es lo de exception

si en este caso pongo un mindate, y le bajo, me sale aviso de que la fecha es menor, pero no puedo controlarlo con el exception
en el formshow he puesto esto
Código Delphi [-]
begin
fechasalida.mindate:=fecharegistro.date+1;
TRY
fechasalida.OnChange:=fechasalidachange;
EXCEPT ON E: EXCEPTION DO
begin
SHOWMESSAGE('LA FECHA NO PUEDE SER IGUAL A LA FECHA DE ENTRADA');
fechasalida.date:=fecharegistro.date+1;
end;
END;
pero no me lo realiza.

alguna idea?

gracias
Responder Con Cita