02-16-2018 12:15 PM
VisaNS was the legacy .NET API for VISA that NI developed several years ago. While it is still supported, for new applications we suggest the use of NationalInstruments.Visa API that is an implementation of the IVI standard VISA .NET API.
Unlike in VisaNS where ResourceManager provided static method to get the local ResourceManager on which you would call the Find method, in the new API, you would create a new object of the ResourceManager class and then call the Find method on that object. Please see the NI-VISA .NET Help that is installed on your system for more details. You can get to it from the start menu (All Programs >> National Instruments >> NI-VISA >> NI-VISA Documentation).
02-16-2018 01:01 PM
Hope is restored. How about an example (in VB.NET)?
02-16-2018 01:33 PM
There are several c# based examples installed here (which can be reached from All Programs >> National Instruments >> NI-VISA >> Examples):
C:\Users\Public\Documents\National Instruments\NI-VISA\Examples\.NET\
I took a snippet from the find resources example and converted to VB.NET and used a different search string of the form "USB?*" because you are interested in finding USB resources.
Imports System
Imports System.Collections.Generic
Imports Ivi.Visa
Imports NationalInstruments.Visa
Module Module1
Sub Main()
Using rm = New ResourceManager()
Try
Dim resources As IEnumerable(Of String) = rm.Find("USB?*")
For Each s As String In resources
Dim parseResult As ParseResult = rm.Parse(s)
System.Console.WriteLine(s, parseResult.InterfaceType)
Next
Catch ex As Exception
System.Console.WriteLine("Exception" + ex.Message)
End Try
End Using
System.Console.ReadLine()
End Sub
End Module
Hope this helps.
02-16-2018 03:16 PM
Uh,oh.... You did it! You're my hero! Now get NI to put it in their manual.
Good job. Thank you so much.
Dave