296
Chapter 8 Application Programs
VB.net Example Program
8
VB.net Example Program
This example is written in VB.net. The example includes Open, Close,
Self-test, Digital I/O, and Scan commands for the 3499A/B/C using the
Agilent T&M Toolkit in VB.net (Visual Basic). As the example is cur-
rently written, the program requirements are:
•
GPIB interface selected and set to the address of 09 from the front-
panel;
•
A GPIB interface card installed in your PC with the VISA library;
•
An Agilent N2265A installed in Slot 1 of the mainframe;
•
The Agilent T&M Toolkit installed on your PC.
Imports Agilent.TMFramework
Imports Agilent.TMFramework.InstrumentIO
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Private myDirectIO As DirectIO
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
'Create DirectIO object.
myDirectIO = New DirectIO("GPIB0::9::INSTR", False, 2000)
myDirectIO.Timeout = 2000
End Sub
Private Sub Selftestbtn_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Selftestbtn.Click
'Send *TST (Selftest) command to the 3499.
myDirectIO.WriteLine("*tst?")
Timing.Delay(10000000)
'Read results
Dim Results As String
Results = myDirectIO.Read()
Textbox1.Text = Results
End Sub
Private Sub Results_TextChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Textbox1.TextChanged
End Sub