Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Importing national instruments .net assembly references to VB??

Hi, I am just starting out trying to use .net to control instruments over GPIB.  I asked someone to give me a small code example to help me learn and in the code in the very top portion of code Imports NationalInstruments.Common & Imports NationalInstruments.NI488.2 are included but I keep getting an error message for both  that says

 

"Namespace or type specified in the Imports 'NationalInstruments.Common' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases."

 

Also I am getting another error message from this variable:   

 

Public GPIB As LangInt = New LangInt

 

The error message for this says: "type 'LangInt' is not defined."  I am not sure if the person who gave me this code made a typo or not, or if this function is not supported in the xpress edition of VB 2009 that I am using.  If anyone has any suggestions or ideas I would really appreciate it.  Here is the code example.  All it is supposed to do is send the IDN query command to a source meter and then return the value to a message box.  Thanks for your help!!

 

Imports NationalInstruments.Common

Imports NationalInstruments.NI4882

 

Public Class Form1

 

Public GPIB As LangInt = New LangInt

Public Keithley_ID As Integer

Public GPIBCard As Integer

 

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

 

Dim Ket_Channel As Integer

Ket_Channel = 26

GPIBCard = 0

Keithley_ID = GPIB.ildev(GPIBCard, Ket_Channel, 0, 10, 1, 0)

Dim Command As String

Dim Results As String = ""

 Dim MaxDataToRead As Integer = 200

Command = "*IDN?"

GPIB.ilwrt(Keithley_ID, Command, Len(Command))

GPIB.ibrd(Keithley_ID, Results, MaxDataToRead) '

MsgBox(Results)

 

End Sub

End Class

 

 

 

0 Kudos
Message 1 of 2
(3,873 Views)

Hi Snow Boarder,

 

What version of the NI-488.2 driver are you using? You might want to check with the person who sent you the code to make sure you have matching versions. If you need a different version you can find them on our site here.

 

Thanks

Scott M

Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(3,834 Views)