Get aliasIfExists Information in VISA C# .NET Application

Updated Jun 7, 2018

Reported In

Driver

  • NI-VISA

Issue Details

The NI VISA C and VB libraries have a function that returns information on aliasIfExists. This gives the user-defined alias for a VISA resource if one exists. I cannot find the function and data types to get this aliasIfExists information in C#. How do I do this?

Solution

The ResourceManager class in the VISA .NET API contains a function called Parse that you can utilize to get an object of type ParseResult. This ParseResult class has the property AliasIfExists, a string representing the user-defined alias for a VISA resource if it exists. 
  1. Instantiate an object of the ResourceManager class.
  2. Call the ResourceManager's Parse function with the input parameter as the name of the VISA resource you would like to get the AliasIfExists information about. This function will return an object of type ParseResult.
    1. ​If you do not know the VISA resource name, you can use the ResourceManager function Find to return a list of VISA resources matching a certain pattern. 
  3. ​Read the AliasIfExists property of the ParseResult object. 
This implementation utilizes both the NationalInstruments.Visa namespace and the Ivi.Visa namespace. 

Additional Information

The VISA .NET API Help is located on Windows machines in the following location: 

C:\Users\Public\Documents\National Instruments\NI-VISA\Documentation\

You can open the latest VISA Help files here, and browse through the classes in .NET VISA. 

WAS THIS ARTICLE HELPFUL?

Not Helpful