[Gambas-user] Eval, and "Eval" for assignment?

Mike Brett serif at ...1870...
Tue May 27 08:13:43 CEST 2008


Thanks, Benoit.  Very clear.

Benoit Minisini wrote:
> On lundi 26 mai 2008, Mike Brett wrote:
>> Q1. Why does something like this fail with "Unknown symbol" please?
>>
>> PRINT Eval("lblMaterial" & "6")
> 
> Because Eval() does not use the context of the function where it is executed. 
> Eval() is run a global context, it can only use global classes.
> 
>> Q2. I have a set of consecutively named labels (lblMaterial0,
>> lblMaterial1, and so on) to which I want to assign text values from a
>> database. Eval() is clearly not designed for assignment purposes, so
>> what's the cleanest way to do this in gambas please?
>>
>> I'm looking for a solution like
>>
>> FOR EACH dbResult
>>    ??Eval??("lblMaterial" & CStr(iC)).Text = dbResult!value
> 
> Form class has a Controls pseudo-collection: Form.Controls["lblMaterial" & 
> CStr(iC)] will return a reference to the control.




More information about the User mailing list