Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Using the old NI bas-files for accessing a GPIB board in Visual Basic.NET

Dear All,

Does someone has an update for the
vbib-32.bas and Niglobal.bas files that works in Visual Basic.NET.

You can't use them anymore because the keyword any isn't supported anymore in Vusual Basic.NET. I did some experiments with other variable types but it don't works.

Thanks in advance

Johannes
0 Kudos
Message 1 of 15
(5,674 Views)
Johannes -

Thanks for utilizing the Developer Exchange forum to share your development questions.

Currently, we do not have language interface files available for the direct development of GPIB in the Visual Basic .NET environment. Since this is the case, I believe that the best alternative available is the direct DLL call. You will always be able to make direct calls to the DLL, and there is lots of documentation available online here at ni.com for these types of calls.

I hope that this will serve as a viable workaround for your development question. Thanks again for your continued support of National Instruments!

Best Regards,

Greg Wempe
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 2 of 15
(5,674 Views)
Johannes,

I was able to get these working for VB.NET, by doing the following:

1) Use the upgrade wizard to get the vbib-32.vb and niglobal.vb files.

2) Change all Any to String, and make sure they are ByVal not ByRef.

ex: Declare Function ibrd32 Lib "Gpib-32.dll" Alias "ibrd" (ByVal ud As Integer, ByVal sstr As String, ByVal cnt As Integer) As Integer

This has worked for me so far, at least using the most used commands (ildev, ilclr, ilwrt, ilrd).

Hope it helps,

Jason
Message 3 of 15
(5,674 Views)
Dear Jason

Thanks for the suggestions! I adapted the old bas files and it seems to work really fine!

Only for the FindLstn command I had to adapt some little things. You have to pass arrays (of the type short) instead of a single argument. In the call to the dll you have to add brackets and in the function itself you have to pass an arrays (with brackets).

Thanks for the help!

Johannes
0 Kudos
Message 4 of 15
(5,674 Views)
Would you please attach the vbib-32.vb and niglobal.vb here? It was because I am using Visual Basic .Net standard version which does not bundle with the upgrade wizard.

If i get the vbib-32.vb and niglobal.vb, I import both .vb files into a new project and start coding, will it work?

Thanks.

I look forward to your files attachments.
0 Kudos
Message 5 of 15
(5,674 Views)
Have the files been attached at all? I'd also really appreciate them...

Were you able to come up with a solution?

Thanks.
0 Kudos
Message 6 of 15
(5,674 Views)
Jason,

I've converted the vbib-32 and niglobal files to vb.net, however I'm still having some problems. When I try to call any of the functions I get the error:
"Object not set to a reference". Which implies to me that the library is not being loaded (or something of the sort). How did you get around this problem? Can you give me an example of how you called the functions? Did you use DllImport at all?

Thanks,
Amanie
0 Kudos
Message 7 of 15
(5,674 Views)
Hello MikeWok:Could you provide me with the vbib-32.vb and niglobal.vb files if you have them,If you could send them as an e-mail attachment..thanks in advance. bcottiers@hotmail.com
0 Kudos
Message 8 of 15
(5,674 Views)
There is .NET support for GPIB with a more user-friendly API that you can test out at the http://www.ni.com/beta website when you choose the "Measurement Studio Technology Preview Program for Visual Studio .NET" link. If you sign up there, you will be notified once you are enabled for full access to the website.

Regards,
Geneva L.
GPIB/Serial Product Support Engineer
National Instruments
http://www.ni.com
0 Kudos
Message 9 of 15
(5,674 Views)
After registeration, it is said that the Beta Program registration is a year-round activity, you may not hear from us until it is time to begin the next round of Beta for the product for which you have applied....

I would like to ask how can I get the visual basic .net sourcecode for Basic GPIB communication?
0 Kudos
Message 10 of 15
(5,452 Views)