Hi all!

I wonder if someone of you knows how are returned objects in a property or a function.

For example i've got a function caller:
VB Code:
  1. dim a as new object
  2. a = getObjectA()

and a function:
VB Code:
  1. Public function getObjectA as object
  2.   try
  3.     dim objReturn as new Object
  4.     return objReturn
  5.   catch ex as exception
  6.   finally
  7.     objReturn = nothing
  8.   end try
  9. End sub

I would like to know:

Will the function return a copy of the object or a reference?
Will the line 'objReturn = nothing' destroy returned object ?
How can i be safe when disposing an object?

In the past, I have got many problems because i didn't dispose objects and now that i want to dispose them, im stuck with "Object disposed" errors.

Is there someone who can help me?

Regards
Pat