Using the VISA C API in Microsoft .NET

Agilent VISA.NET

Using the VISA C API in Microsoft .NET

Test and measurement programmers accustomed to using the VISA C API (implemented by the visa32.dll C DLL) for communicating with instruments are familiar with the visa32.h C standard header file for use in C and C++. This header file is defined by the VXIplug&play Systems Alliance and distributed by Agilent Technologies, among others. The alliance also defines a header file VISA32.bas for Microsoft  Visual Basic 6. However, there are at present no officially defined header files for programming in the VISA C API in the Microsoft .NET technology languages, such as C# and Visual Basic .NET.

This document describes Agilent's .NET header files for VISA, VISA32.cs for C# and VISA32.vb for VB .NET; provides examples for some of the methods; and provides a tutorial for using these files. Agilent defines and provides these files to allow programmatic access to the VISA C API from the two most popular .NET languages.  

Programmers wishing to use the VISA C API in .NET should include the appropriate file in their project.  The compiled .NET assembly will then have all the information it needs to use the VISA C Library (visa32.dll.)  The Tutorial shows how to include and compile a program using these header files.

This help is broken into several topics following the introduction. The first, VISA API Essentials, provides examples and brief descriptions of the core set of methods you need to communicate with instruments through Agilent's .NET header files for VISA. The second section, Tutorial, provides a brief tutorial in both C# and VB .NET describing a complete use of these files from start to finish. The third section, Advanced Use of viPrintf/viScanf, describes how to add parameters and make your own versions of these functions. The last section, .NET Types and VISA C Types Reference, describes the translation of the C VISA data types to .NET and provides a conversion table.