Dynamic Controls - C#

namespace CS_WindowsFormsApplication1 {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }

        private AxSftBoxLib40.AxSftBox axSftBoxDesign;
private AxSftBoxLib40.AxSftBox axSftBoxRuntime; private void button1_Click(object sender, EventArgs e) { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); SuspendLayout(); axSftBoxRuntime = new AxSftBoxLib40.AxSftBox(); ((System.ComponentModel.ISupportInitialize)(axSftBoxRuntime)).BeginInit(); axSftBoxRuntime.Location = new System.Drawing.Point(axSftBoxDesign.Location.X + 50, axSftBoxDesign.Location.Y + 50); axSftBoxRuntime.Name = "axSftBoxRuntime"; // THIS IS IMPORTANT: We are using the properties as defined by AxSftBoxDesign to create the dynamic control axSftBoxRuntime.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axSftBoxDesign.OcxState"))); axSftBoxRuntime.Size = new System.Drawing.Size(258, 38); axSftBoxRuntime.TabIndex = 0; Controls.Add(axSftBoxRuntime); ((System.ComponentModel.ISupportInitialize)(axSftBoxRuntime)).EndInit(); ResumeLayout(false); } } }