Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 207
  • Last Modified:

Returning an object.

Hi. Problem. I have a program which has a method which returns an object. The problem is that when the object is returned, it only has the correct value for the object name, which is the default property. However, when the object is set in the procedure, debugging shows that all the properties are set. It's as if the object is being passed 'byref' as oppose to 'byval'.

If anyone can help, I'd appreciate it.
0
NikW
Asked:
NikW
1 Solution
 
caraf_gCommented:
Your method may be returning a New instance of the object or something like that.

I can make a few educated guesses but the best thing is for your to paste your code so experts can analyse it.
0
 
MirkwoodCommented:
You most likely do something like this in your subroutine

--- BEGIN CODE ---
function myfunction ()
   dim yyy as MyObject
   .....
   .....
   myfunction = yyy
end function

Dim xxx as myobject
xxx = myfunction
--- END CODE ---

This copies only the default value.
Use
set xxx = myfunction
and
set myfunction = yyy
0
 
NikWAuthor Commented:
Of course! How stupid of me!

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now