Visual C# COM Application

Using the same objects, methods and variables as in VBA one can also create a COM application using C# programming language to automate Pro-Designer. This however requires that you have a C# debugger and programming environment such as MS Visual Studio which includes Visual C#. Familiarity with Visual C# is important for taking full advantage of the Pro-Designer COM Server, this manual provides the basic initial steps to begin with Visual C#.

When you start the Visual Studio application you create a new project by selecting File / New / Project on the main menu and from the dialog that appears you select Visual C# as your language from the left pane and the Windows Application template from the right. This will do the necessary work to create the foundation on which your application can be built on. In order to make C# code to work with the Pro-Designer COM interface, one should load as in the Visual Basic Editor, the Designer Type Library. This is done by right clicking on the References properties, and selecting Add Reference as shown in the following image:

C__Reference.jpg

 

 

On the dialog that appears you switch to the COM tab and you scroll down and click on the SuperPro Designer Component Name. Make sure the path of the reference library (“Designer.tlb”) is correct, and click on OK. You can now view the Object Browser by right clicking on the Designer object and selecting View in Object Browser as shown in the following image:

C__Object.jpg

 

Once you have completed the above procedure, you may start writing your code and/or designing your interface. Your code with all your declarations, initializations of objects and data exchanging with Pro-Designer can be written in the Form1.cs file. The Form1.cs file can be viewed/edited by right clicking on the Form1.cs file and selecting View Code as shown in the following image:

C__code.jpg

A Visual C# example that utilizes the Pro-Designer COM server is included with this manual. The example can be found in the Pro-Designer installation directory under the folder /Examples/COM/C#/COMEx1/. The solution file that must be loaded in Visual Studio is COMEx1.sln.