From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use "GPIB-USB-HS" in C#

Solved!
Go to solution

Hi there,

I have a mission is "use GPIB control several of instruments"

But I am not good at program and first use GPIB-USB-HS.

My boss only gave me previous project, but it's not work now.

 

It's show error code "CS0246" in program.

(Of course I have other error, but I think this is the most important)

I tried to add reference but program didn't work too.

(Project>Add reference>choose "National Instruments 488.2" and "NationalInstruments.Common")

 

using Ivi.Visa;
using NationalInstruments.Visa;

Above is the code with error.

 

I installed NI 488.2 first and I confirm the connection to instrument is successful (by Ni-VISA Interactive Control)

How to solve error code "CS0246"?

or where can I find sample code?

 

 

System: Win10

hardware: GPIB-USB-HS

Visual studio: 2019 community

Project: Windows Forms APP (.NET Framework)

 

Best regards,

 

 

0 Kudos
Message 1 of 7
(2,947 Views)
Solution
Accepted by ChuChuNice

You're "using" VISA but never added it as a reference.

 

Please add a reference to the VISA library

santo_13_0-1634516740164.png

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 2 of 7
(2,901 Views)

Dear Mr. Santhosh

 

I can't find "Ivi.Visa Assembly" & "National Instruments VISA" in reference.

Did I miss some software?

未命名.png

 

Thanks for your help.

 

0 Kudos
Message 3 of 7
(2,893 Views)

You have the necessary software installed.

 

The screenshot you posted is from NI Package Manager. You've to include the references in your C# project in Visual Studio and not in NIPM.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 4 of 7
(2,887 Views)

Dear Mr.Santhosh,

 

Sorry for reply late.

I mean I can't find "Ivi.Visa Assembly" & "National Instruments VISA" in reference.

未命名.png未命名.png

Above is VS2019 screenshot.

Page "Projects", "Shared Projects" and "Browse" is empty.

 

And I actually installed NI VISA.

未命名.png

 

Did I miss any steps?

 

0 Kudos
Message 5 of 7
(2,866 Views)

Try searching just for "VISA" under Assemblies>>Framework

 

And changing the target framework to 4.0 or 4.5

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 6 of 7
(2,861 Views)

Dear Mr.Santhosh,

 

You totally solved my question.

Thanks for your help.

0 Kudos
Message 7 of 7
(2,853 Views)