Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Format for using [DllImport("Visa32.dll")] for viOpen() in .net C#

I am using .NET C# to program a small application that uses [DllImport("Visa32.dll")] for the viOpen() api. I've used several versions of the prototype but keep getting VI_ERROR_RSRC_NFOUND error (viOpenDefaultRM works fine). Anybody have working examples of making this call from .NET using [DllImport] ? The resource string is "GPIB0::22::INSTR" and MAX finds it just fine.
0 Kudos
Message 1 of 2
(5,011 Views)
Hello Scott,

Have you tried running NI-Spy to see the viOpen() call come through VISA? If it works in MAX, you should be able to see a difference between the viOpen() call that MAX uses and the viOpen() call that you are making from .NET. NI-Spy can be found in the National Instruments program group. Just hit the bluegreen arrow to start the capture, then try it in MAX and .NET and compare the working and nonworking calls. Post the resulting .spy file here if you need help interpretting it.

Scott B.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(5,010 Views)