Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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" wrote in message ... 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks! I should then use the WIDTH keyword
"Bob Phillips" wrote in message ... 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" wrote in message ... 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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Mark,
Sorry, but I do not understand that comment. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Mark" wrote in message ... Thanks! I should then use the WIDTH keyword "Bob Phillips" wrote in message ... 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) |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Bob, I not sure that's right. My understanding is that A is a
reference (pointer) to C. A isn't a new Collection object in its own right because it hasn't been instantiated. Rather it will just hold the address in memory of C. Hence A *will* hold the same data as C. Jamie. -- "Bob Phillips" wrote in message ... 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. "Mark" wrote in message ... 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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I guess I saw New where there wasn't one. But, I just, and it even seems to
be the case when you New A(?). I admit to being confused by what I am seeing, so it back to the books methinks ( Curland's) Bob "onedaywhen" wrote in message om... Bob, I not sure that's right. My understanding is that A is a reference (pointer) to C. A isn't a new Collection object in its own right because it hasn't been instantiated. Rather it will just hold the address in memory of C. Hence A *will* hold the same data as C. Jamie. -- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel assignment | Excel Discussion (Misc queries) | |||
point assignment | Excel Discussion (Misc queries) | |||
Key Assignment Log | Excel Discussion (Misc queries) | |||
assignment problem | Excel Worksheet Functions | |||
excel assignment | Excel Discussion (Misc queries) |