title: How to pass data from C# to dll
body: <p>I have project in vb named FamServer. In it , a class named FamApp is available . In that class , a function named FamEnroll is available .
  I have converted this project to dll .I have added this dll to my project . The famenroll funcion in dll is defined as below : </p>
  
  <pre><code>Public Function FamEnroll(strName As String, strEnrollTemplate As String, strIP As String) As String
  </code></pre>
  
  <p>I have called this dll by the following code : </p>
  
  <pre><code>FamServer.FamApp famApp = new FamServer.FamApp();
  
            famApp.FamEnroll(name, Request.Form["LearnModel"], Request.ServerVariables["REMOTE_ADDR"]);
  </code></pre>
  
  <p>But when I am running this code , I am getting the following error : </p>
  
  <pre><code>Exception Details: System.InvalidCastException: Unable to cast COM object of type 'FamServer.FamAppClass' to interface type 'FamServer._FamApp'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{B2CC832C-CF23-4023-9C87-711F425EC323}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
  </code></pre>
  
  <p>The stack trace is as below : </p>
  
  <pre><code>[InvalidCastException: Unable to cast COM object of type 'FamServer.FamAppClass' to interface type 'FamServer._FamApp'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{B2CC832C-CF23-4023-9C87-711F425EC323}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).]
     System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr&amp; ppTarget, Boolean&amp; pfNeedsRelease) +0
     FamServer.FamAppClass.FamEnroll(String&amp; strName, String&amp; strEnrollTemplate, String&amp; strIP) +0
     famenroll2.Page_Load(Object sender, EventArgs e) in f:\ASP.NET Projects\ASPNET\famenroll2.aspx.cs:27
     System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
     System.Web.UI.Control.OnLoad(EventArgs e) +95
     System.Web.UI.Control.LoadRecursive() +59
     System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678
  </code></pre>
  
  <p>Why am I getting this error ? How can I solve this error ? Please help me . </p>