Click here to Skip to main content
15,922,533 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to find a way in C# to do what Interaction.CreateObject(string ProgId, string ServerName) does in VB.NET.

So is there another was to create the interoperability between the vendor DLL that we use in VB.NET with C#?

Primary problem is that this function is only available in MS.VB.dll and VB.MET is very forgiving. It allows us to only program the ProgID parameter and not the ServerName and thereby automatically creating an overloaded implementation. On the other had C# requires all parameters to be provided, I have no idea what it is looking for in ServerName because the application runs locally only.

Is there a cleaner way to create this interoperability work in C#, if so could you show me an example of the code that will work?

In looking at the DLL in ObjectBrowser it shows the Vendor.DLL as Interop.Vendor, does this mean I can just reference it like we did back in VB6?

thanks.
Posted

1 solution

Try checking the MSDN Documentation on CreateObject. If you click on the C# tab in the Syntax section, you will see how it works.

[Addition]
In addition to the documentation on CreateObject, you ask about the interop.vendor.dll that will appear in your output folder. This is an autogenerated wrapper for the COM component that you get by adding a reference to the component in your project.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 17-Feb-11 22:24pm    
OP commented:

Thanks That appears to at least solve the complier level problems.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900