User`s guide

22 Agilent VISA User’s Guide
2 Building a VISA Application in Windows
If the program does not run, see the Event Viewer for a list of run-time
errors. The source file idn.bas follows.
Option Explicit
''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''
' idn.bas
' This example program queries a GPIB device for
' an identification string and prints the
' results. Note that you may have to change the
' VISA Interface Name and address for your
' device from "GPIB0" and "22",respectively.
''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''
Sub Main()
Dim defrm As Long 'Session to Default
Resource Manager
Dim vi As Long 'Session to instrument
Dim strRes As String * 200 'Fixed length
string to hold results
' Open the default resource manager session
Call viOpenDefaultRM(defrm)
' Open the session to the resource
' The "GPIB0" parameter is the VISA Interface
' name to a
' GPIB instrument as defined in
' Connection Expert.
' Change this name to what you have defined
' for your VISA Interface.
' "GPIB0::22::INSTR" is the address string
' for the device.
' this address will be the same as seen in:
' Connection Expert)