When using Visual C#.NET

Visual C#.NET

 

Specification of Functions

In C#,a direct GPIB driver function is not called but the method of a class library is called.The function of a GPIB driver is called from the method of a class library.Since the method in a class library is defined by the form excluding prefix from the function from the first Please call according to it.

 

Ex.)In the case of a GpIni function

Ret = gpib.Ini ();

 

Format of function references

It is not dependent on the development language to be used,and the contents of a function argument and a return value become common.Please refer to [function reference]for details.

 

Sample Programs

Please see following folders.

\Program Files\CONTEC\API-PAC(W32)\XXX\Samples\VCSNET

 (XXX is SIO/DIO/AIO/GPIB/GPLV/CNT/SMC)

 

Creates a project

Visual Studio.NET --starting --[New]-[Project]is chosen [from [File]]A [Visual C#project]is chosen from [Project Types]of a [New Project]dialog box.[Windows Application]is chosen from [Template].The project name created to [Name]is inputted.The directory which creates the new subdirectory for a project is inputted into [Location]if needed.A click of the [OK]button creates a project.

 

Include of a class library

Using the function of a GPIB driver,a class library CgpibCs.cs file is needed by Visual C#.NET.[Project]-CgpibCs.cs is added from [Add Existing Item]

 

Add name space

A name space is added in order to use the method in a class library.Please add the following parties to the head of C#source code (***.cs file).

 

using CgpibCs;

 

Creation of a class instance

The instance of a class is created in order to use a GPIB class library.The following lines are added to the head of a form class in C#source code (***.cs file).

 

public class Form1 :System.Windows.Forms.Form

{

Cgpib gpib = new Cgpib(); // Add

 

Example of change of type declaration

VisualC++ Visual C#.NET

 

BYTE * -> string or StringBuilder

DWORD -> uint

DWORD * -> ref uint or uint[]