object reference

Hi,
I have an object in a collection.
I pass it by ref to a form in order to edit it (the form has a local var to hold it).
I also store in the form an un-referenced copy of the object to allow the user canceling the operation (in which case I thought to 'return' the copied un-changed object).
The problem is that when canceling, setting the local referencing variable to the copied unchanged object doesn't affect the original item in the collection - reference issue.
Can I change the reference using AddressOf or ObjPtr (or anything else) so that setting the local referencing variable will do the trick?

What you want is transaction based objects like they're used in MTS components (just like SQL transactions). But i guess that's a overkill ;-))

Normally you apply changes to your object when you click 'OK' or 'Save', any change before is kept in another structure like a String or a Textarea. When the user clicks on OK, the String is set at your object.

If you want to work with your object, then implementing Clone methods could also do the job. When you load your editing form, clone your object and let the form do instant manipulating of your clone. If the user clicks on 'OK', save the clone in your collection at the index of your original object.

the un-referenced object I mentioned is a clone of the one stored in the collection - there are 2 identical objects in the begining and the changes are done to one of them, but in order to discard the changes it is not enough to do 'Set ChangedObject = ClonedOriginalObject' cause the changes already took place (it's a reference) and the assignment won't undo them.
What I need to do is set the actual place in memory pointing to the changed object so that it would point to the cloned unchanged one.