Link to home
Start Free TrialLog in
Avatar of cybermoonlight
cybermoonlight

asked on

copying objects

Please can soemeone help...i have a control on a form and i would like to be able to have an exact replica created when a button is clicked...the control in question is part of a control array....
basically i need to copy an object, clone it in other words..
thankyou very much
Avatar of Mirkwood
Mirkwood

You probably now how to add a new entry to the control array.
But here is some code

i = ubound(contarray)+1
load contarray(i)
contarray(i).move left,top, width, height
contarray(i).show

ASKER CERTIFIED SOLUTION
Avatar of caraf_g
caraf_g

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Your could use the "TypeLib Information" library (TLBINF32.DLL) to make a generic CopyObject function.
Just list all the source object properties, and for each, invokeHook-get from the source object and invokhook-put to the target object.

Use On Error Resume Next to skip read-only, and design-time only properties...


Avatar of cybermoonlight

ASKER

cheers caraf..shame vb doesn't have a built in function....thankx