VISA and GPIB Application Development Using C# or VB.NET

Updated Dec 13, 2019

Reported In

Software

  • Measurement Studio
  • Package Manager

Driver

  • NI-VISA
  • NI-488.2

Issue Details

I am trying to develop a C# or Visual Basic .NET Framework application that uses VISA or GPIB communication. How can I go about doing this?

Solution

National Instruments provides native .NET interfaces with the NI-VISA and NI-488.2 drivers for use in C# and Visual Basic .NET (VB.NET). The driver software also includes documentation and shipping examples for using VISA and GPIB in C# and VB.NET. 

 

Installing .NET Support

The .NET features are installed by the respective hardware driver installer. If you already have NI-VISA or NI-488.2 installed, refer to Modify NI Software in NI Package Manager to add .NET Development Support. 

If you don’t already have the drivers installed, follow the steps below.
  1. Download NI-VISA or NI-488.2. Refer to the Readme of the driver version to check system compatibility. 
  2. In the installer, make sure to enable .NET support by selecting the desired .NET Development Support version. 



 
  1. Finish the installation as normal. 
 

Adding Reference to a .NET Project

To use the VISA or GPIB API in a .NET project, you must first add the appropriate assembly references to the project. 

Select the project in the Solution Explorer and click Project»Add Reference... 
The references for the GPIB and VISA APIs are:
  • NationalInstruments.Common
  • GPIB API Reference: NationalInstruments.NI4882
  • VISA API Reference: NationalInstruments.NIVisa
 

Finding Documentation and Resources

The installer will also install API overview, concepts, and function reference documentation for the VISA and 488.2 .NET class libraries. 

Select Start >> Programs >> National Instruments
  • For VISA documentation, select NI-VISA Documentation >> NI-VISA .NET Help (Latest) >> NINETVISAHelp
  • For GPIB documentation, select NI-488.2 .NET Framework Help ​​​​​​​

​​​​​​​To get to the same help topics from within Visual Studio .NET 2003 or later, go to Help»Contents and expand NI Measurement Studio Help.

For Visual C# and Visual Basic .NET examples, refer to NI-DAQmx, NI-VISA, and NI-488.2 .NET Example Locations.