From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Using Microsoft Visual C# to Find all VISA Resources and Perform Communication

Code and Documents

Attachment

This application uses the Measurement Studio CWVISA ActiveX object in Visual C# to find all VISA resources on a machine. All instrument descriptors returned are placed in a list box. After the instrument descriptors are returned, the user can select an instrument from the list and write to and read from that particular instrument.

This example is developed with Microsoft Visual Studio 2002. Opening the project with Visual Studio 2003 or Visual Studio 2005 automatically upgrades the example.

Note: VISA 3.2 and higher now includes a native .NET API for developing VISA applications using C# and Visual Basic .NET. This API has been customized to make full use of all the functionality provided by the .NET Framework. Examples of using the VISA .NET API from C# and Visual Basic .NET and function reference help are included with NI-VISA. The VISA .NET API does not require Measurement Studio.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors