12
Programming Examples
VISA COM Example in Visual Basic .NET
To compile and run this example in Microsoft Visual Studio 2005:
1
2
3
4
5
6
For more information, see the VISA COM Help that comes with Agilent IO
Libraries Suite 15.
'
' Agilent VISA COM Example in Visual Basic .NET
' -------------------------------------------------------------------
' This program illustrates most of the commonly used programming
' features of your Agilent oscilloscopes.
' -------------------------------------------------------------------
Imports System
Imports System.IO
Imports System.Text
Imports Ivi.Visa.Interop
Imports System.Runtime.InteropServices
Namespace InfiniiVision
834
Open Visual Studio.
Create a new Visual Basic, Windows, Console Application project.
Cut- and- paste the code that follows into the C# source file.
Edit the program to use the VISA address of your oscilloscope.
Add a reference to the VISA COM 3.0 Type Library:
a
Right- click the project you wish to modify (not the solution) in the
Solution Explorer window of the Microsoft Visual Studio
environment.
Choose Add Reference....
b
c
In the Add Reference dialog, select the COM tab.
d
Select VISA COM 3.0 Type Library; then click OK.
e
Right- click the project you wish to modify (not the solution) in the
Solution Explorer window of the Microsoft Visual Studio environment
and choose Properties; then, select
"InfiniiVision.VisaComInstrumentApp" as the Startup object.
Build and run the program.
Class VisaComInstrumentApp
Private Shared myScope As VisaComInstrument
Public Shared Sub Main(ByVal args As String())
Try
myScope = New _
VisaComInstrument("USB0::2391::5957::MY47250010::0::INSTR")
Initialize()
' The extras function contains miscellaneous commands that
Agilent InfiniiVision 7000A Series Oscilloscopes Programmer's Guide