[Gambas-user] Function doing unexpected things...

sbungay sbungay at ...981...
Thu Jul 20 22:06:40 CEST 2006


   Yes.

nando wrote:
> Is 'ClassName.SubTotal' a float ??
> 
> 
> ---------- Original Message -----------
> From: sbungay <sbungay at ...981...>
> To: gambas-user at lists.sourceforge.net
> Sent: Wed, 19 Jul 2006 22:34:37 -0400
> Subject: [Gambas-user] Function doing unexpected things...
> 
> 
>>How to explain this without writing tons of code... hmmmmm.. here goes.
>>   I have a class which contains 3 public variables of type float.
>>   The class gets instantiated.
>>   One of the items within the class is named "subtotal" and it's value 
>>is derived by summing up the items in one column of a grid. To do this I 
>>wanted to use a function which returned type Float. So (keeping code 
>>here to a minimum) the whole mess looks kind of like this...
>>
>>ClassName.SubTotal = ComputeSubTotal(GridName,GridName.Column)
>>
>>Private Function ComputeSubTotal (SourceGrid AS GridView, Col as 
>>Integer) AS Float
>>Dim SubTotal AS Float
>>.
>>.
>>.
>>Logic to sum the column into "SubTotal" goes here
>>.
>>.
>>.
>>Return SubTotal
>>End
>>
>>   Gives me the error
>>
>>"Expected Float, got Function"
>>
>>   I expected the assignment to take the return value of the function 
>>not the function itself... is this a bug or am I doing something wrong? 
>>I can work around it using a SUB but IMHO it is more elegant to use a 
>>function.
>>
>>P.S.
>>   Haven't used GAMBAS for over a year, just downloaded the latest 
>>version and compiled it... it's looking very good Benoit. I like the new 
>>editor.
>>
>>-------------------------------------------------------------------------
>>Take Surveys. Earn Cash. Influence the Future of IT
>>Join SourceForge.net's Techsay panel and you'll get the chance to share your
>>opinions on IT & business topics through brief surveys -- and earn cash
>>http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>>_______________________________________________
>>Gambas-user mailing list
>>Gambas-user at lists.sourceforge.net
>>https://lists.sourceforge.net/lists/listinfo/gambas-user
> 
> ------- End of Original Message -------
> 
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 




More information about the User mailing list