Windows Develop Bookmark and Share   
 index > Windows Forms General > Copying Controls
 

Copying Controls

Is there anyway to make a copy of a control and change the properties in the copy of the control without chaning the properties to the orginal. Something like this...

Control _newControl = _orginalControl;

_newControl.Controls.Clear();

D3M1TR1US  Tuesday, March 11, 2008 11:06 PM

Not really. If the control implemented IClonable you coudl. Basically you have to copy the fields over. You could use some generic reflection tool to reflect over all public properties and copy them over, but this may not always work.

Dan Rigsby  Tuesday, March 11, 2008 11:16 PM

Not really. If the control implemented IClonable you coudl. Basically you have to copy the fields over. You could use some generic reflection tool to reflect over all public properties and copy them over, but this may not always work.

Dan Rigsby  Tuesday, March 11, 2008 11:16 PM

You can use google to search for other answers

Custom Search

More Threads

• Error while canceling print: "startdocprinter call was not issued"
• How to capture the event form window maximized in c#
• Inherited DataGridView and the mystery of the duplicated Columns
• Change priority of application
• Change Margin / Padding during runtime.
• webbrowser, InvokeScript, ComVisibleAttribute?
• Open report from a form
• How to implement a 30 day trial period?
• Let's kill a PDF!!!
• Trying to print