Is it possible to pass a collection by reference from vb6 to vb.net?
-
I have created a collection class in vb.net to pass a collection from vb.net to vb6 and everything works great. I am now trying to send a collection to a function by reference. The collection is created in vb6 but the function is in a class in vb.net. The function needs to be able to update the collection (thus byRef).
-
I have created a collection class in vb.net to pass a collection from vb.net to vb6 and everything works great. I am now trying to send a collection to a function by reference. The collection is created in vb6 but the function is in a class in vb.net. The function needs to be able to update the collection (thus byRef).
sashaw2 wrote:
The function needs to be able to update the collection (thus byRef).
Does it need to replace the collection with a new instance, or just modify items within the collection? You should only need to pass an object by reference if you're going to replace it with a different object, and want that change to be visible to the calling code.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
I have created a collection class in vb.net to pass a collection from vb.net to vb6 and everything works great. I am now trying to send a collection to a function by reference. The collection is created in vb6 but the function is in a class in vb.net. The function needs to be able to update the collection (thus byRef).
-
sashaw2 wrote:
The function needs to be able to update the collection (thus byRef).
Does it need to replace the collection with a new instance, or just modify items within the collection? You should only need to pass an object by reference if you're going to replace it with a different object, and want that change to be visible to the calling code.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
It does not need to replace the collection. It will need to make changes to the collection in vb.net and have those changes reflected in the vb6 collection.
Then you don't need ByRef. Non-value types, like your collection, are always passed by reference anyway. You're not getting a copy of the collection.
A guide to posting questions on CodeProject
How to debug small programs
Dave Kreskowiak -
Then you don't need ByRef. Non-value types, like your collection, are always passed by reference anyway. You're not getting a copy of the collection.
A guide to posting questions on CodeProject
How to debug small programs
Dave Kreskowiak