472,353 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

ActiveX and C# Interop

I am having problems getting an ActiveX DLL written in VB6 to call a
method in a C# class library component.

My C# DLL is called CSharpProject.dll and contains a public class
called CSharpClass. In this class is a single public method that
returns the string "Hello

from C sharp".

My VB6 ActiveX DLL references the C# DLL (CSharpProject.dll) using the
type library CSharpProject.tlb. The ActiveX DLL contains two methods,
the first just

returns a string declared within the method, and the second tries to
call the method defined in the C# component.

I then have a simple ASP.Net webform (Webform1.aspx) that creates an
instance of the ActiveX object using client side Javascript.

Everything works fine on my local machine but when I try using it on
another machine I get the following error(s):

1) "File or assembly name CSharpProject, or one of its dependancies,
was not found"


I have tried the following things to resolve the problem:

C# Component:

* I have created the tlb file for the CSharpProject.dll

1) automatically using the setting in Visual Studio "Register for COM
Interop" set to true.
2) using the .net tool tlbexp
3) using regasm /tlb option

(I have also ensured that the .tlb file is registered on other
machines using a tool called Reggie.exe.)

* I have tried creating a strong name for the component and
registering it in the GAC but this doesn't solve the problem.


VB6 ActiveX DLL:

* I have referenced the tlb as per a normal reference.

The code is as follows:

Public Function method1() As String
On Error GoTo fail
foo = "dave"
Exit Function
fail:
foo = "Error in foo occurred in VB ActiveX DLL (" & Err.Description
& ")"
End Function

Public Function method2() As String
On Error GoTo fail
Dim objCSharp As New CSharpProject.CSharpClass
Dim tmp As String
tmp = objCSharp.foo()
method2 = tmp
Exit Function
fail:
method2 = "Error occurred in VB ActiveX DLL (" & Err.Description &
")"
End Function

NOte: I have also tried using the following code to declare and
instantiate the C# class -

Dim objCSharp
Set objCSharp = CreateObject("CSharpProject.CSharpClass")

However this returns the following error message from the VB6 ActiveX
DLL: "Object doesn't support this property or method."


javascript:

var obj = new ActiveXObject("VBActiveXDLL.VBClass1");
alert(obj.method1());
alert(obj.method2());

All works fine on my local machine but when I copy/register/install
all the components on another machine (which has Visual Studio.Net and
v6 installed) it

doesn't work.

Any suggestions, comments, or ideas would be much appreciated
Thanks

Craig
Jul 21 '05 #1
0 1787

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Sorin | last post by:
Hi all I have a .NET application that is using few ActiveX DLL wrote in VB6. I managed to get the most from my previous VB6 controls by using...
1
by: Craig | last post by:
I am having problems getting an ActiveX DLL written in VB6 to call a method in a C# class library component. My C# DLL is called...
5
by: andy.g.ward | last post by:
I keep getting this when trying to create an MFC activex control in a c# windows service - anyone got any ideas what the missing module could be???...
1
by: James Pannozzi | last post by:
I'm just starting a C++ application which will send data to someone else's program (written as a VB ActiveX COM app) and receive some data back...
1
by: Mehr H | last post by:
I have been working on this for several days and am still have had no success in achieving this. Pleae help. It seems that documentation for this...
4
by: FanTian | last post by:
I want to insert an ActiveX control into asp .net web page, but it seems I fall in trouble now. When I insert the ocx control into toolbox and drag...
3
by: Jeffery Franzen | last post by:
Anyone know where the documentation is regarding Activex controls in asp web forms? I'm using VS.NET 2002 enterprise and am trying to use Activex...
23
by: Galen Somerville | last post by:
A VB6 ActiveX.exe raises an event which is seen by the VB6 App. Same setup in VB2005. The event to be raised is in form frmSweep. As in VB6,...
3
by: Lou | last post by:
I know I can make an ActiveX dll in .NET and it uses interop. So I end up with 2 files, the .dll and the interop file. I also know I need to use...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.