Solved

Returning an object.

Posted on 1999-01-25
3
193 Views
Last Modified: 2013-11-26
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
Comment
Question by:NikW
3 Comments
 
LVL 10

Expert Comment

by:caraf_g
ID: 1470489
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
 
LVL 13

Accepted Solution

by:
Mirkwood earned 20 total points
ID: 1470490
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
 

Author Comment

by:NikW
ID: 1470491
Of course! How stupid of me!

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question