Agilent 4155C/4156C VXIplug&play Driver User’s Guide, Edition 4 4-7
Programming Examples for Visual Basic .NET Users
Programming Basics
Sub save_data(ByVal fname As String, ByVal title As String, ByVal val As String,
ByVal data(,) As String, ByVal nop1 As Integer, ByVal nop2 As Integer, ByVal Ag415x
As Hp4156b) ’51
Dim i As Integer = 0
Dim j As Integer = 0
FileOpen(1, fname, OpenMode.Output, OpenAccess.Write, OpenShare.LockReadWrite)
Print(1, val)
For j = 0 To nop2 - 1
For i = 0 To nop1 - 1
Print(1, data(j, i))
Next
Next
FileClose(1)
Dim rbx As Integer
For j = 0 To nop2 - 1
For i = 0 To nop1 - 1
val = val & data(j, i)
Next
Next
val = val & Chr(10) & Chr(10) & "Data save completed."
val = val & Chr(10) & Chr(10) & "Do you want to perform measurement again?"
rbx = MsgBox(val, vbYesNo, title)
If rbx = vbYes Then perform_meas(Ag415x)
End Sub ’73
End Module
Line Description
51 to 73 Save_data subprogram saves measurement result data into a file specified by the fname
variable and displays the data and a message on a message box. If Yes is clicked on the
message box, calls the perform_meas subprogram again. If No is clicked, returns to the
perform_meas subprogram.