Start a new topic

Using custom code libraries (DLLs) - "Cannot create ActiveX component."

Hi all,

Trying to do something a bit funky. I want to display a custom control/form to allow the operator to select a proposal from those that are active on the constituent's record.

Cribbing from some other posts here on the forum ("External .vb files?", "Call another application") I thought I'd got a pretty good idea of what I needed to do:

  •  ~ I've build a custom code library which contains a windows form element and a custom type to carry the data
  •  ~ I've made all my structures public and have placed the DLL inside the RE plugins folder
  •  ~ I've added Imports IOMlibrarytest to the top of the file
  •  ~ And I've tried creating an object using o = CreateObject("IOMlibrarytest.Test")

Unfortunately I am struggling to get IOM to use the types and methods that the DLL contains. Instead, I get the following error:

Line 1: Error in custom code AfterConstituentOpen: Cannot create ActiveX component. Line:0 -->ImportOM.CImport.Process()

What have I missed?

Ah the classic try-everything-at-once approach! I am a big fan!
Thanks Wayne.

I think I disregarded registering the assembly after I read this:
Any outside .NET application would need to be located in your plugins folder or registered in the GAC (Global Assembly Cache). Placing your dll file in the plugins folder is an easier solution.
But, after using regasm I've found that I can get it to work. Annoyingly, I'm not sure which step I took was the critical one and it may not have been the registration. Next time I'll be more systematic. :(
I actually found it easier to put up the list in an InputBox (standard VB) and have the user enter a number to select the correct one. I do this for tributes. Building forms is a pain and usually it's just one key piece of information that will let them choose which one they want.
you have to register to DLL on the system to be able to call it.

Oh, by the way, I've made a minimal code sample as part of my testing. Might be handy to rule out my stupid coding.

Can't seem to attach a file here, so here's a link for download:

All it contains is two VS projects. One is a really lightweight class that just contains a public static string. The other is just a console application that reads the string from the class and prints it to screen.

The console application reads the string no problem, but IOM spews out the "Cannot create ActiveX component." error.

Plus, I've tried adding a ".init()" to the CreateObject call. No luck.

Login or Signup to post a comment