title: How can I create variable controls at runtime?
body: <p>I'm trying to create controls at runtime using Reflection.
  In my case, I get a string like Label or Button and I would like to create a object Label or Button of it.</p>
  
  <pre><code>Assembly WinFormasm = Assembly.Load("System.Windows.Forms,Version=2.0.000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
  
  Control label = (Control)Activator.CreateInstance(WinFormasm.GetType("System.Windows.Forms."+type));
  </code></pre>
  
  <p>When I execute this, I get the error:</p>
  
  <blockquote>
    <p>File or assembly name 'System.Windows.Forms,Version=2.0.000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', or one of its dependencies, was not found.</p>
  </blockquote>
  
  <p>I don't realy know what is wrong there. I have also tried:</p>
  
  <pre><code>try
  {
      Type cntrl = Type.GetType("System.Windows.Forms.Button,System.Windows.Forms, Culture=neutral, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089", true);
      label1.Text += cntrl.ToString() + " ";
  }
  catch(Exception e)
  {
      label1.Text += e.ToString() + " ";
  }
  </code></pre>
  
  <p>Trying this, I got an execution error: he can't create the type and returns <code>null</code>. If I change the gettype string into <code>System.Int32</code>, it works.</p>
  
  <p>How can I create a control item using a string?</p>