Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

IVI-C (dll) usage in VB.NET?

I have a 34420A nanovolt meter which has a NI IVI-C driver (dll) which I want to use within VB.NET
 
I can access the attributes within VB.NET but I don't see the functionality... the initialization of the instruments, read commands etc.  Basically the dll appears to be like an API to the instrument but it does not seem intuitive on how to use.  Again I see no functionality other than access to the attributes, I don't see the methods.
 
What does one need to do to get an IVI-C dll from NI to work within VB.NET?
 
Thanks in advance
0 Kudos
Message 1 of 2
(3,928 Views)

Hello TestStandUser,

Based on your explanation, I can't tel what you're describing. Are you attempting to add a reference to the driver's dll in your project? If so, you will likely not get the results you are looking for. Adding an unmanaged dll to a managed code project (which, by definition, all vb.net projects are) will cause the environment to try and generate a COM interop assembly for the component. I'm guessing that what you're seeing is the constant identifiers for the properties, which would be available from the driver's type library. the C API itself is not visible because there is no automated interop support for C API's in the .NET framework. If you want to use unmanaged C or C++ code in a .NET project, you must use a part of the .NET Framework called Platform Invoke, also referred to as P/Invoke. There are numerous resources related to  P/Invoke on MSDN - here's a link to start with.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkplatforminvoketutor...

We also have some online resources available to describe how to use IVI-C instrument drivers in .NET languages, available here:

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000x2jLCAQ&l=en-US

As noted in the above NI Developer Zone article, Measurement Studio includes the Measurement Studio Instrument Driver .NET Wizard, which creates a .NET class around an existing IVI-C driver. If you are a Measurement Studio customer, I believe this tool will provide exactly the kind of class-based driver API you are looking for.

Please let me know if there are other resources that would help you with your problem.

Glenn Burnside

 
Message 2 of 2
(3,926 Views)