title: VB.net load dll
body: <p>I have been attempting to load a DLL using Reflector</p>
  
  <pre><code>Imports System.Reflection
  </code></pre>
  
  <p>I have a simple DLL file written in c++ using /CLR (this is the entire file)</p>
  
  <pre><code>using namespace System;
  
  
  namespace ASSEMBLE{
  
  public class REM{
      public:
          int VALUE(){
              return 100;
          }
  
      };
  
  };
  </code></pre>
  
  <p>And inside my VB.net butten click event i have</p>
  
  <pre><code> Dim dllPath As String = "C:\Users\richard\Documents\Visual Studio 2012\Projects\link\link\bin\Release\dlltest.dll"
          ' load the assembly 
          Dim assembly1 As System.Reflection.Assembly = Assembly.LoadFrom(dllPath)
          ' get the type 
          Dim t As Type = assembly1.GetType("ASSEMBLE.REM")
          ' create an instance and add it. 
          Dim c As Object = Activator.CreateInstance(t)
  
  
          MsgBox(t.InvokeMember("VAULE", BindingFlags.Default Or BindingFlags.InvokeMethod, Nothing, c, {}))
  </code></pre>
  
  <p>When event triggered (ie. i load the dll) i get the error:</p>
  
  <pre><code>Method 'ASSEMBLE.REM.VALUE' not found
  </code></pre>
  
  <p>Using:</p>
  
  <pre><code>&lt;DllImport("DLL.dll")&gt; Public Shared Function VALUE() As Integer
          End Function
  </code></pre>
  
  <p>is not an option. I need to load the DLL after runtime.</p>