I wrote a dll in c#.net that calls another third party .NET dll within the application. This works fine when I tested it with a console application written in c#.NET as well using the code below:
Assembly u = Assembly.LoadFrom(dllLocation);
Type t = u.GetType("MyLIB.CLass");
MethodInfo m = t.GetMethod("Method");
object[] myparam = new object[1];
myparam[0] = fileLocation;
result = (string)m.Invoke(null, myparam);
Please note that some files are loaded within the location where the dll was initially loaded as well using:
string path = Assembly.GetExecutingAssembly().Location;
path = Path.GetDirectoryName(path);
But the issue is that when I tried to call it using VB6, I get an error that it cannot load the third party dll. Please help as I seem not to know what's going on.
I would thought to give you more detail, in order .NET Assembly expose to COM
you need to generate the tbl - type library
using RegAsm /tlb: MyLIB.tlb MyLIB.dll
There are Guidelines to expose .NET Types to COM and make sure you cope with that. such as declare ComVisibleAttribute , require a public default constructor to be visible to COM , such are in
you can refer that in How to call a Visual Basic .NET or Visual Basic 2005 assembly from Visual Basic 6.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With