title: How to use Activator.CreateInstance to instantiate an external class?
body: <p>I have an application where I want to instantiate a class that is completely outside the application, perhaps written at a later date by a third party.  So the class cannot be known, but the interfaces in the class are known.  So I want to use late binding.</p>
  
  <p>In my code (VB.NET), I have the following:</p>
  
  <pre><code>Dim a As Object
  a = Activator.CreateInstance("MyNameSpace.CustomClass", "")
  MsgBox(a.Name)
  </code></pre>
  
  <p>I get an exception at the second line:  <code>Could not load file or assembly 'MyNameSpace.CustomClass' or one of its dependencies. The system cannot find the file specified.</code> even though the assembly is in the same folder as the executable.  I can't use Type.GetType() because the type is not known to the calling assembly.</p>