Problem invoking Method using COM enums
- I am having a problem with late binding invoking of a method from a COM dll.
Everything works fine as far as loading the dll creating an instance of the
class. I even have no problem invoking the method as long as it does not
contain any enumerations in its parameters. This is where my problem lies.
I have done testing and I can invoke methods with .NET enums but when it
comes to using a COM dll it does not like its own enumerations at all. I get
an error message specifying that the target type is not the same as the
given type. I have tried a variety of different types to see if any match:
System.Object, System.IntXX, Integer, Long, Enum itself. All these tried
with no luck.
I have included at the bottom code that I am using to invoke the method. If
you have any ideas concerning a solution/workaround for this problem it
would be much appreciated.
Public Function InvokeMethod(ByVal assemblyFile As System.String, ByVal
className As System.String, ByVal methodName As System.String, Optional
ByVal args() As System.Object = Nothing) As System.Object
Dim oAssembly As System.Reflection.Assembly =
Dim oType As System.Type = oAssembly.GetType(className)
Dim oMethodInfo As System.Reflection.MethodInfo =
Dim oInstance As System.Object =
InvokeMethod = oMethodInfo.Invoke(oInstance, args)
Catch eException As System.Exception