This is obviously generated code for an automation server.
You should forget about converting this code from VO to .Net.
It simply uses too many undocumented and unsupported features to work in .Net.

However: there is a much better solution in .Net, and it works and is being used by millions of C# and VB users in the world.

Inside Visual Studio you can attach a Automation Server as reference. This will start a tool that creates a .Net wrapper library to communicate with the Automation Server.
I am working on an article that describes step by step on how to do this.
The short version is:
- Create a new app in Visual Studio (lets say a Console App)
- Choose 'Add Reference'
- Select the COM tab in the Add Reference dialog
- Choose the Automation Server (let's say Microsoft ActiveX Data Objects (ADO) which is the Access database engine)
- Click OK
- This will add a reference to your app "ADODB"
- This will create the file "Interop.ADODB.dll" in your apps folder structure
- When you right click on the reference you can open it in the Object Browser to view its contents
- You can then use the code in the generated wrapper like normal .Net code:

Thank you for you help I will try it ! I will read your article obviously.

But a contact I have said this to me :
"Even if you solve the pcount() problem it will not work in the long run because of all the pointers in the code."

And then, this :
"You should approach it in a totally different way.
If you have installed MODI on your system, you can best create a C# project (library).
Reference it to the Microsoft Office Digital Imaging type library.
Then write the methods (Access) like NumChars in C# ."

What do you mean by "Automation Server" ? I don't understand...

I tried what you explained to me, but in the object browser, it created a big library with a lot of methods and functions.

In fact, i have to convert the method you see down there in C# and create a library that contains all of them. But i don't know how to do correspond all the properties and other methods it uses from X# to C#.

Leo,
Your contact was right: the VO code will not port.
However there is no need to write a C# wrapper. X# can do all that is needed.
Adding the reference what you contact said is what I suggested as well.

What I mean with automation server is this:

In general there are 2 ways COM is used:

1) To Remote Control an application. Such as opening, modifying and writing office documents with Word or Excel. This is also known as "Automation". For Automation there are 2 sides: the Client and the Server. The Clients uses an API that the Server exposes. I was referring to this as Automation Server

2) Adding a (usually visual) component to an application. For example a Graph control, a Report Viewer control or a PDF viewer control. Components that provide this are known as OCX or ActiveX. They usually also have some kind of Automation Interface, so you can control their behaviour and looks from your code.

Robert

XSharp Development Team
The NetherlandsThis email address is being protected from spambots. You need JavaScript enabled to view it.