Agilent 4155C/4156C VXIplug&play Driver User’s Guide, Edition 4 3-3
Programming Examples for Visual Basic Users
Programming Basics
Programming Basics
This section provides the basic information for programming using the Agilent 
4155/4156 VXIplug&play driver.
• “To Create Your Project Template”
• “To Create Measurement Program”
To Create Your Project Template
This section explains how to create a project template using Microsoft Visual Basic. 
Before starting programming, create your project template, and keep it as your 
reference. It will remove the conventional task in the future programming.
Step 1. Connect instrument (e.g. Agilent 4155/4156) to computer via GPIB.
Step 2. Launch Visual Basic and create a new project.
Step 3. Import the following file to the project.
• hp4156b.bas (e.g. \Program Files\VISA\winnt\include\hp4156b.bas)
• visa32.bas (e.g. \Program Files\VISA\winnt\include\visa32.bas)
Step 4. Open a form (e.g. Form1) in the project.
Step 5. Enter a program code as template. See Table 3-1 for example. The example code is 
written in Visual Basic 6.0.
Step 6. Save the project as your template (e.g. \test\my_temp).
NOTE To Start Program
If you create the measurement program by modifying the example code shown in 
Table 3-1, the program can be run by clicking the Run button on the Visual Basic 
main window. After that, a message box will appear. Then click OK to continue.