Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

niSwitch using C#?

Is it possible to use niSwitch using Measurement Studio and C#? I know it is possible using NIDAQmx and the NationalInstruments.DAQmx.Switch class, but my card (PXI2565) is not supported by NIDAQmx...
0 Kudos
Message 1 of 10
(5,467 Views)
Hi Mr. Saelens,

Yes, this is possible. When you install NI-switch and go to START>Programs>National Instruments>NI-SWITCH>examples, there you will find some examples for the .NET environment

Regards.
0 Kudos
Message 2 of 10
(5,467 Views)
Yes, I found those examples, but the CNiSwitch class does not exist in my C# environment...
0 Kudos
Message 3 of 10
(5,467 Views)
So, if you go to the Add/Remove Class Libraries wizard in the Measurement studio menu, you cannot choose in the Ni Device Instrument drivers the NISwitch checkbox?
0 Kudos
Message 4 of 10
(5,467 Views)
No, do I have to install something extra? I installed the latest version of NI-DAQ with NI-Switch already...

What I see is:
Measurement Studio Components
Enterprise Analysis Library
DataSocket Library
Windows Forms Controls
Measurement Studio Hardware APIs
DAQmx Library
NI-488.2 Library
VisaNS Library
National Instruments Application APIs
TestStand APIs
0 Kudos
Message 5 of 10
(5,467 Views)
I think that you forgot to install the measurement studio support of the Modular drivers, like NI-switch. Do a custom installation of you driver CD and make sure that you select the Measurement Studio support for NI-switch, NI-scope,...

Regards.
0 Kudos
Message 6 of 10
(5,467 Views)
Om the May 2004 driver CD, there is only a Measurement Studio for Visual C++ selection under NI-SWITCH 2.2, no .Net languages support like for DAQmx.
0 Kudos
Message 7 of 10
(5,467 Views)
Hello Mr. Saelens,

I'm really sorry. I was confusing C++.Net with C#.

I'm afraid that you are actually correct in saying that C# is not supported. There is only Visual C++.Net support for NI-switch in Measurement studio. I'm sorry about that. I cannot import a NI-Switch class in a C# project.

The 2565 is supported in daqmx 7.2. You can check the support list attached below.

Regards.
0 Kudos
Message 8 of 10
(5,467 Views)
Hello HSaelens

I am attaching a C# and VB.NET wrapper that was created for NI-Switch 2.2 using Measurement Studio 7.0 Instrument Driver wizard. This wizard lets you use the Switch C api functions from C# and VB.NET by generating .NET interop code for you.

To use these wrappers from an existing project, add them to the solution by going to the Solutions Explorer. Right click on the project name, go to Add >> Add Existing Item. Select the .vb/.cs file for the instrument of your choice in your VB.NET/C# project.

You can refer to the individual wrapper files to make sure you include the correct namespaces. The individual cs and vb file
s contain comments that describe the individual functions.

I hope this helps

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 9 of 10
(5,467 Views)
Thanks!

This works fine.

Hans Saelens
0 Kudos
Message 10 of 10
(5,467 Views)