User`s guide

20 Agilent VISA User’s Guide
2 Building a VISA Application in Windows
Strings
When reading in a string value with viVScanf or viVQueryf, you
must pass a fixed length string as the params parameter. To declare a
fixed length string, instead of using the normal variable length
declaration:
Dim strVal as String
use the following declaration, where 40 is the fixed length.
Dim st
rVal as String * 40
Sample VISA Program (Visual Basic)
This section lists a sample program called idn that queries a GPIB
instrument for its identification string. This sample builds a standard
.exe application for WIN32 programs using the Visual Basic 6.0
programming language.
Assuming default installation directories, the idn sample files are in
C:\
Program Files\Agilent\IO Libraries Suite\
ProgrammingSamples\VB6\VISA\IDN
Steps to Running the Program
The steps to building and running the idn sample program follow.
1 Connect an instrument to
a GPIB interface that is compatible with
IEEE 488.2.
2 S
tart the Visual Basic 6.0 application.
This example assumes you are building a new project (no .vbp file
exist
s for the project). If you do not want to build the project from
scratch, from the menu select File > Open Project... and select and
open the idn.vbp file. Then skip to Step 7.
3 S
tart a new Visual Basic Standard .exe project. VB 6.0 will open a
new project, Project1, with a blank Form, Form1.
4 From
the menu, select Project > Add Module, select the Existing
tab, and browse to the idn directory. If you used default installation
paths, this directory is C:\Program Files\Agilent\IO
NOTE