Ver Mensaje Individual
  #2  
Antiguo 02-05-2013
cloayza cloayza is offline
Miembro
 
Registrado: may 2003
Ubicación: San Pedro de la Paz, Chile
Posts: 915
Reputación: 23
cloayza Tiene un aura espectacularcloayza Tiene un aura espectacular
Lightbulb

Bueno a ver si te puedo ayudar...Mirando el código que escribiste puedo ver que requieres valida el contenido del Edit4 y este debe ser un valor numérico...

Bueno para ello podría quedar así...

Código Delphi [-]
var
   Valor:Integer;
begin
        //TryStrToInt intenta trasformar el valor string a numero entero...Si hay exito devuelve True, de lo contrario False;
       if Not TryStrToInt(edit4.Text,Valor) then
          Exit;
       //Uso de Exception...
      Try
          if (existe_sit_iva(validar_sit_iva,Valor)=false)  then 
             edit5.Text:='error'
          else
             edit5.Text:=mostrar_desc(mostrar_descri,Valor);
      except //para cualquier error que se produsca...
           raise Exception.Create('Mostrar_Texto_Error');
      end;
end;

Variante...
Código Delphi [-]
var
   Valor:Integer;
begin
       if Not TryStrToInt(edit4.Text,Valor) then
          Exit;

      Try
          if (existe_sit_iva(validar_sit_iva,Valor)=false) then
             edit5.Text:='error'
          else
             edit5.Text:=mostrar_desc(mostrar_descri,Valor); 
      except 
            on E:Exception do Showmessage( E.Message );
      end;
end;

Busca en la ayuda Exceptions, raise, try
Saludos cordiales
Responder Con Cita