p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

aspx thread: Reg-calling Managed component from vb

Message #1 by "kasthurit" <kasthurit@c...> on Fri, 23 Feb 2001 14:36:55 +0800

I created one dll using c#  named  testcomserver.dll.

I have registered the dll using the command,

regasm testcomserver.dll /tlb:testcomserver.tlb

while calling this component from VB,i am getting a error message saying 

that "unable to locate assembly".

how can i call the managed component from VB 6.0?

This is the dll:testcomserver.dll

using System;

namespace AndyMc


 public class CSharpCOMServer


  public CSharpCOMServer(){}

  public void SetName(string name){m_name=3Dname;}

   public string GetName(){return m_name;}

  private string m_name;



VB code

Private Sub Command1_Click()

Dim dotNetObj As New testcomserver.CSharpCOMServer

dotNetObj.SetName ("Hello")

MsgBox "Name is " & dotNetObj.GetName()

End Sub

But its working fine in VB script.

VB script code is.


Dim dotNetObj

set dotNetObj =3D CreateObject("AndyMc.CSharpCOMServer")

dotNetObj.SetName ("Hai")

MsgBox "Name is " & dotNetObj.GetName()

 and run the script like this:

            wscript comclient.vbs

Thanks in Advance.



  Return to Index