0
Reply

Com Callable .NET Assembly

Ask a question
Ted

Ted

13 years ago
8.5k
1
Help!

I am trying to create a .Net assembly with a Com Callable Wrapper to be used in a legacy VB6 application. I have gotten as far as being able to create an instance of the (C#.net) object in VB6. However, I cannot use it in any way. There is a sole property in the object and it is not accessible, nor is it visible in intellisense. Please tell me what is wrong!... and thanks in advance.

Here is what I have done:

-Created the simple C# project exactly as described in this article:

http://www.c-sharpcorner.com/uploadfile/dsandor/activexinnet11102005040748am/activexinnet.aspx

This is just a simple assembly with a textbox control, an interface and a property to set the text. It is used here in a web page, but I want to use it in a vb6 app.

I selected Com Interop Switch
I created a strong name and signed it using sn.exe
I Set Assembly:Delaysign = false in the assembly
I put the resulting .tlb and .dll files in the project folder
I registered the .dll using regasm

Then, In VB6:

I was able to select the .tlb file in "references", and I checked the box to add the ref to the project

I can Dim an instance of the object called "myControl", but that is all. "myControl" DOES appear in intellisense after the NEW keyword.

I tried adding it to the control array using VBControlExtender and I get:
"Error 720 ActivexDotNet.myControl is not a valid control type"

I tried accessing the sole "UserText" method, even though it is not in intellisense, and get a runtime automation error.

I have been scouring the internet for 2 days now and there doesn't appear to be a reasonable solution and I am already past deadline. So thanks again for any help!