Re: Assignment by reference or value

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Bob Phillips (bob.phillips_at_notheretiscali.co.uk)
Date: 02/16/04


Date: Mon, 16 Feb 2004 09:39:36 -0000

Mark,

As far as I can tell from your description, A is neither a copy nor a
reference. It is not a copy as it will hold different data than C, and it is
not a reference as it is a new object in it's own right. It will have a
similar structure as C, being a collection, but will occupy a separate chunk
of memory, and this may be what you mean by copy.

I accept that you cannot pass C to the Button_Click event, but as it is a
public variable it is accessible within the form code, as you show, which
means that if you are happy changing it there, you do not need A.

-- 
HTH
Bob Phillips
    ... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"Mark" <no@email.com> wrote in message
news:c0q1mi$igi$1@news.net.uni-c.dk...
> Hi NG
>
> I have a question about assignment of variables by reference or value.
>
> I have a module where a collection C is defined as public.
>
> In my form i want to use that information. Because i use a callback e.g.
> button_click() i can not parse C in to the function. Instead i do the
> following in the button_click() callback
>
> dim A as collection
> A = modSomething.C
>
> Is A then a copy of C or is it a reference?
>  For performance reasons i would like it to be a reference.
>
> Regards
> Mark
>
>

Quantcast