Technical data
3-6 Agilent B1500A/B1505A Programming Guide, Edition 11
Programming Examples
Programming Basics for Visual Basic .NET Users
Table 3-1 Example Template Program Code for Visual Basic .NET
Imports Ivi.visa.interop
Module Module1
Sub Main() ’5
Dim B1500 As IResourceManager
Dim session As IMessage
B1500 = New ResourceManager
session = B1500.Open("GPIB0::17::INSTR")
session.WriteString("*RST" & vbLf)
MsgBox("Click OK to start measurement.", vbOKOnly, "")
Console.WriteLine("Measurement in progress. . ." & Chr(10))
Dim t() As Integer = {5, 4, 3, 1} ’14
Dim term As String = t(0) & "," & t(1) & "," & t(2) & "," & t(3)
session.WriteString("CN " & term & vbLf)
perform_meas(session, t)
session.WriteString("CL" & vbLf) ’19
session.Close()
MsgBox("Click OK to stop the program.", vbOKOnly, "")
Console.WriteLine("Measurement completed." & Chr(10))
End Sub ’23
Line Description
1 This line is required to use the VISA COM library.
5 to 23 Main subprogram establishes the connection with the Agilent B1500, resets the B1500, 
opens a message box to confirm the start of measurement, and pauses program execution 
until OK is clicked on the message box. By clicking OK, the program displays a message on 
the console window, enables the SMUs, and calls the perform_meas subprogram that will be 
used to perform measurement.
After the measurement, the program disables all SMUs, disables the connection with the 
B1500, and opens a message box to confirm the end of the program. Finally, by clicking OK 
on the message box, the program displays a message on the console window.
9 The above example is for the B1500 of the GPIB address 17 on the interface GPIB0. 
“GPIB0” is the VISA name. Confirm your GPIB settings, and set them properly.
14 to 15 The above example uses the SMUs installed in the B1500 slots 1, 3, 4, and 5. Change the 
slot numbers for matching your configuration.










