[Gambas-user] Property question....

Stephen Bungay sbungay at ...981...
Fri Mar 14 15:08:44 CET 2008


Stephen Bungay wrote:
> Benoit Minisini wrote:
>> On vendredi 14 mars 2008, Stephen Bungay wrote:
>>>   Given the following....
>>>
>>> PUBLIC mRecordSet AS Result
>>>
>>> PROPERTY RecordSet AS Result
>>> PRIVATE FUNCTION RecordSet_Read() AS Result
>>>    RETURN (mRecordSet) ' This will probably never get used
>>>                        ' access mRecordSet directly.
>>> END
>>>
>>> PRIVATE SUB RecordSet_Write(Value AS Result)
>>>    IF NOT IsNull(Value) THEN
>>>       IF Value.Count > 0 THEN
>>>          mRecordSet = Value
>>>          PopulateForm
>>>       END IF
>>>    END IF
>>> END
>>> .
>>> .
>>> .
>>> ' Only gets called when Property RecordSet is written to...
>>> Private Sub PopulateForm()
>>>    ' Code to populate the form from data in mRecordSet goes here
>>> END
>>>
>>>
>>> An assignment of a result set to property 'RecordSet' will yield
>>> "Unknown identifier: RecordSet at line [line number] in [formname].class.
>> This is a compiler error. Please explain how you can get it at runtime while 
>> assigning the property!
>>
> 
>    Yes the error is happening at compile time and is something I did not 
> expect (i.e. since RecordSet is declared as a property it should be a 
> 'known' identifier).

   So if we have a button on the form called Button1 and the intent of 
this action is to execute an SQL and assign the result to the property 
'RecordSet', that is where the compiler presents the error. It appears 
that the compiler isn't aware of the Property.

Private Sub Button1_Click()
    'Compiler gives an 'unknown identifier' error on the next line.
    RecordSet = DatabaseConnection.Exec("Select * FROM MyTable")
END

> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> 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