Solved

Returning an object.

Posted on 1999-01-25
3
168 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Share codes 68 115
Help in WHSCRIPT 9 41
MS SQL store procedure to calculate and return result 6 35
Visual Studio 2005 text editor 10 23
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now