Trying to access .NET code from Xojo

Hi everyone,
i was testing a really old example from the blog for accessing .NET code from Xojo, written in 2014 by Paul Lefebvre.
https://blog.xojo.com/2014/01/03/accessing-net-code-from-xojo

I can add the .Net Library as an ActiveX component, but i always get an error:

There is no class with this name
Dim o As New xojoTestProject.InterfaceImplementation

Isn’t this example up to date anymore? Has anything changed?

Not all .NET libraries register them self’s as ActiveX. They need to have ActiveX flag in then project manifest when their compiled if I remember correctly.

Thanks Björn,
i think the ActiveX component itself is ok. The error refers only to InterfaceImplementation as if this class is not found, but i can find it in the .net code.

Check if the class has the following flag:

<System.Runtime.InteropServices.ComVisible(True)>

The interface you might see in ActiveX / COM but implementation not found if the class is not exposed to ActiveX / COM.

I made it exactly like in Paul’s example:

using System.Runtime.InteropServices;

and also

checked the “Register for Com interop” checkbox

in the build section

Thanks Björn, now i got it. I didn’t understand that i had to change the InteropServices Flag in the assemblyinfo.cs. Problem solved!

1 Like