How to call COM Module-based method?
Hi guys!
Lets try this other scenario. I have a third party COM API(Neteng.tlb file) which is full COM compliant. I used this COM object in my VB 6 programs by adding a reference to it. When i browse its library thru Object Browser i noticed it has a lot of enumerations(enum in c#) and types(struct in c#) defined. It also exposes one method (NE_AddElement) but this is a MEMBER of a Module.
-----------------------------------------------------------------
It says in Object Browser like...
Sub NE_AddElement(netedit As Long, elatt As ElementAttRec)
Member of NETENG.NETENGAPI
Add the given element using the specified element record.
WHERE NETENGAPI IS...
Module NETENGAPI
Member of NETENG
-----------------------------------------------------------------
That means that this method belongs to the Module not to the class so after i made a reference to the COM i can automatically used the NE_AddElement method defined there and it works fine. My VB 6 program can recognized the method.
Now i tried using the same COM API (Neteng.tlb) inside a VB.Net/C#. I made a reference to that COM API (as a COM object) inside my VS.NET IDE using the COM portion and it goes fine. I was successful at doing that but when i compile the code it RETURNED a compilation error saying:
----------
The name 'NE_AddElement' does not exist in the class "myclass name here"(CS0103)
----------
Why is that it can't recognized the NE_AddElement method though i have successfully Add a Reference to its COM? When i checked the equivalent InterOp assembly created after making the referencing i noticed it only exposes the class level enumerations and class level structs. Members of NETENGAPI (a Module) like the method NE_AddElement were not exposed. In VB 6 it can recognized the method as member of the NETENGAPI module. Can someone tell me how My VB.NET/C# program can fully recognized and in doing so used the NE_AddElement method!!!!
Tnx in advanced!!!