Specifications

Chapter 18 339
PSA Programming Examples
Using Visual Basic® .NET with the IVI-Com Driver
PSA Programming Examples
Copyright (c) 2003. Agilent Technologies, Inc.
*************************************************************************
Option Strict On
Imports Agilent.TMFramework
Imports Agilent.AgilentSa.Interop
Imports Ivi.Driver.Interop
Imports System.Runtime.InteropServices
Module ConsoleApp
Sub Main()
Prompt the user for the address of the instrument
Dim address As String
Console.WriteLine("Enter address of the instrument " & vbCrLf & _
"(ex: GPIB0::18::INSTR or TCPIP0::192.168.100.2::inst0::INSTR):")
address = Console.ReadLine()
Try
Create an instance of the driver, connection to the instrument
is not established here, it is done by calling Initialize
Dim instr As New AgilentSaClass()
Establish the connection to the instrument
Last parameter (DriverSetup) is optional, VB could omit it (but not C#)
Important: Close must be called to release resources used by the driver
instr.Initialize(address, False, False, "")
Try
INHERENT CAPABILITIES
Note that it is not necessary to program against the IIviDriver
interface, the same can be achieved by using the class directly
Using the IIviDriver interface gives us interchangeable code
Dim inherent As IIviDriver = instr