How do I duplicate objects in VB6?
Lets say I have 2 objects Obj1 and Obj2 of the same class. I wish to create a copy of Obj1 in Obj2. Simply 'Set'ing the objects will make them point to the same object in memory.
One way would be to copy each property by property, such as:
Obj2.Prop1 = Obj1.Prop1
Obj2.Prop2 = Obj1.Prop2
and so on... but this is time-consuming and will not work with read-only properties and child objects. There must be be a faster way of doing this!
Can anyone help?????
Lets say I have 2 objects Obj1 and Obj2 of the same class. I wish to create a copy of Obj1 in Obj2. Simply 'Set'ing the objects will make them point to the same object in memory.
One way would be to copy each property by property, such as:
Obj2.Prop1 = Obj1.Prop1
Obj2.Prop2 = Obj1.Prop2
and so on... but this is time-consuming and will not work with read-only properties and child objects. There must be be a faster way of doing this!
Can anyone help?????