Copying UserControl Variables to another instance of the UserControl
-
Greetings! I was wondering if I could get some direction to get me started in implementing a "copy/paste" of the properties of a UserControl. In my application, I have 10 instances of a particular UserControl. This UserControl has, say, 10 properties. I would like to be able to use the right-click menu that I have for this UserControl and be able to copy the "settings" of one instance to any other instance of the UserControl. From what I've read on MSDN, I understand that I have to make the UserControl class Serializable and that the variables that I do not copied can be excluded using the [NonSerializable] attribute, thus so:
[Serializable] public class ctlMyControl : ctlBaseControl { int nNum1; // Copied float fNum2; // Copied [NonSerializable] float fNum3; // Not Copied // The rest of the code }
My question is how does one implement the actualy copy and paste? What function(s) do I use to perform the copy and what function(s) do I use to paste? Your help is appreciated! Thanks!