[Gambas-user] Passing objects by reference

Chris Wilson blixtra at ...626...
Fri Dec 10 13:35:05 CET 2004


On Fri, 10 Dec 2004 00:55:26 -0500, Rob <sourceforge-raindog2 at ...94...> wrote:
> On Thursday 09 December 2004 20:48, Chris Wilson wrote:
> > Is it possible to pass objects by reference in Gambas?
> 
> I was under the impression that object types were always passed
> by reference, but you could always make an array with one member
> (your object) and pass that into the routine.
> 
> Rob

I think there is something I'm not understanding here.

When I try your work-around ,I get an error that there is a missing AS
for the last line in the following:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
PUBLIC studentRS AS Result

studentRSArray AS Object[]
studentRSArray.Add(studentRS)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Going back to the original question about passing as reference..... 

What I have is a Result (studentRS) object declared in the form class.
 In this form class I call a SUB (fillTable), which is passed
studentRS, in a module that successfully fills the the table. When the
table's data event is triggered however, I get an eror that studentRS
is a Null object.  This happens when I define studentRS like above. 
If I define like this:

PUBLIC studentRS AS NEW Result

then I get an error that Result is static.  I'm not sure what this all
means or what i'm doing wrong on both counts.

I've never touched VB so maybe this is just my ignorance.

Chris




More information about the User mailing list