Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

GPIB VBIB-32.bas and NIglobal.bas code conversion from VB6 to Vb.net/ C#

Hello folks,

 

I'm working on converting an application written in Visual Basic 6.0 into Vb.Net or C#. The VB6 application uses GPIB to communicate with the external device and has used the following module -  VBIB-32.bas and NIglobal.bas. I had made some syntax modifications and have renamed modules to VBIB32.vb and NIGLOBAL.vb. I would like to know whether is there an official NIGLOBAL.vb and VBIB32 module files for vb.net or C#.

 

It would be of great help if someone can help with anything. Please note I have installed NI 448.2 dll and have added to project reference and added to namespace. It shows no syntax or runtime  error, but the program doesn't give the desired output.

 

0 Kudos
Message 1 of 3
(1,666 Views)

Please note I have installed NI 448.2 dll and have added to project reference and added to namespace. 

 


NI4882.dll  is a windows shared library (with C-like call syntax), not a NET assembly, therefore you shouldn't add it as a reference.  I don't know why MS decided to use the same file extension for these two completely different things.

 

The way to import such dlls in a VB.NET/C# program is different from VB6.  There was a similar thread here

https://forums.ni.com/t5/Measurement-Studio-for-NET/Niglobal-bas-and-Vbib-32-bas-on-visual-basic-201...

but apparently the NET wrapper page link does not work anymore, probably NI does not provide much support for such old boards.  Anyway you won't find VBIB32.vb and NIGLOBAL.vb code directly translated to NET because standard coding techniques in NET are quite different from VB6 (VB6 is not object-oriented and can only import functions, in VB.NET you import classes and not functions). 

Whether or not you are interested learning how to call such plain-C dlls from NET you may have a look at my library here :

https://www.codeproject.com/Articles/1166996/Multithreaded-communication-for-GPIB-Visa-Serial-i

Read about the class  "GPIBDevice_gpib488".  You can use it after replacing the dll name and rebuilding the library (as far as I could see gpib488 and NI4882 are equivalent) as explained there. Otherwise if you don't want to use the library you can still look at the code of this class to see how to import the NI4882.dll functions to VB.NET and C#.

Don't hesitate to send me a PM/email  if you have more detailed questions about this code.

Message 2 of 3
(1,565 Views)

Thank you for your reply. Will check it out and get back to you!

0 Kudos
Message 3 of 3
(1,549 Views)