Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Device is ambiguous, imported from the namespaces of types NationalInstments.DAQmx, NationalInstruments.NI488.2

Solved!
Go to solution
This error occurs when trying to create a Device type object (NI488.2)
0 Kudos
Message 1 of 3
(4,577 Views)
Solution
Accepted by topic author l3eng

You will need to fully-qualify the type name when you delcare it in code.

For example, in C#, this would look like:

NationalInstruments.NI4882.Device myDevice = new  NationalInstruments.NI4882.Device(1, 1);

In VB.NET, this would look like:

Dim myDevice As New NationalInstruments.NI4882.Device(1, 1)

 

David Rohacek

National Instruments

Message 2 of 3
(4,557 Views)

The reason for this is because both the DAQmx and NI4882 namespaces define the Device class.
So, when you reference 'Device' in your code, .NET does not know which class to use, the DAQmx one or the NI4882 one. This is why you have to provide the fully qualified name as David explained if you have both namespaces referenced in your code.

Alternatively, if you don't use DAQmx in your project, removing the using NationalInstruments.DAQmx line from your code should also resolve the issue because then .NET will only be able to see the NationalInstruments.4882 namespace's Device class.

Hope this helps!

Jervin Justin
NI TestStand Product Manager
0 Kudos
Message 3 of 3
(4,534 Views)