Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Problemas para crear una funcion (https://www.clubdelphi.com/foros/showthread.php?t=33350)

fartycl 04-07-2006 18:40:22

Problemas para crear una funcion
 
Lo que pasa es que al declarar la funcion me tira un error

Código Delphi [-]
   Function Ptotal(cuenta:Integer):String;

esta es la funcion

Código Delphi [-]
Function Ptotal(cuenta:Integer):String;
var a:integer;
    cTotal:String;
begin
cTotal:='0';
If Fvta.SqlTemp.RecordCount <> 0 then
Fvta.SqlTemp.First;
For a:=1 to Fvta.SqlTemp.RecordCount do
begin
   Ctotal:= IntToStr(StrToInt(Ctotal)+StrToInt(Fvta.sqltemp.FieldByName('importe').AsString));
  Fvta.SqlTemp.Next;
end;
Result :=ctotal;
end;

y este es el error: Unsatisfied forward or esternal declaration: 'TFVTA.Ptotal'

Fvta es el nombre de mi formulario

bien si me pueden ayudar seria grandioso

seoane 04-07-2006 19:47:50

Dejame adivinar, declaraste la funcion dentro de la declaracion del formulario FVTA, por lo que en la implementacion deberias haber puesto esto:

Código Delphi [-]
Function TFTVA.Ptotal(cuenta:Integer):String;
var a:integer;
    cTotal:String;
begin
cTotal:='0';
If Fvta.SqlTemp.RecordCount <> 0 then
Fvta.SqlTemp.First;
For a:=1 to Fvta.SqlTemp.RecordCount do
begin
   Ctotal:= IntToStr(StrToInt(Ctotal)+StrToInt(Fvta.sqltemp.FieldByName('importe').AsString));
  Fvta.SqlTemp.Next;
end;
Result :=ctotal;
end;

otra solucion es dejarla como esta pero sacar la declaracion de dentro de la declaracion del formulario. :) Espero haberme explicado


La franja horaria es GMT +2. Ahora son las 03:34:22.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi