Agilent Technologies 86038A User Manual page 156

Optical dispersion analyzer
Table of Contents

Advertisement

Remote Operation
156
9 Right click on the Form and select View Code. This brings up a simple Form.vb
Code window, which is probably empty except for Option Explicit. Add the
odaClient object as a member right after that line:
Private WithEvents odaClient As RemoteClient.Communicator
The odaClient will host all the interaction with the ODA. Before you can
use it, though, you need to 'new' the object. Go back to the Form view, and
double click on an unused area of the form. This takes you to the
Form1_Load routine, where you can insert the following line directly above
End Sub:
Set odaClient = New RemoteClient.Communicator
10 Before you can talk to the ODA, you have to establish a link to it. From the tool
bar, place a Button on the form. From the Properties dialog, Name the button
pbConnect with Caption Connect. Double click the button to edit the source
code. This will place you at pbConnect_Click. The connection to the ODA is
established here. Place the following lines above the final End Sub:
Call odaClient.Connectivity.Connect(tbOdaName.Text)
pbConnect.Enabled = False
You need to implement a disconnect method. This avoids a time-
consuming clean up when a connection goes stale and has to be cleaned
out of the ODA interface.
The second line grays out the Connect button so you do not forget and
connect twice.
11 Go to the code window, and click the drop down list box at the upper left corner
of the Code window. It probably says pbConnect, since you were just editing the
connect method. Change it to Form. Now the list box at the upper right corner
lists the various events you can write code for. It probably says Load. Click on the
selections, and choose Unload. This will take you to Form_Unload, where you
can insert the following lines:
odaClient.Connectivity.Disconnect
odaClient.Connectivity.TerminateSession
Example 1: Simple Application for Controlling the ODA
Agilent 86038A Optical Dispersion Analyzer, Third Edition

Advertisement

Table of Contents
loading

Table of Contents