What are you looking for?
Getting started in Visual Studio .NET - Using VB.NET to control instruments
Microsoft has integrated robust support for COM components in the .NET environment. The COM interfaces translate well into .NET equivalents via automated wrapper-generator tools that Microsoft provides.
Step 1: Open a new project
Start Microsoft Visual Studio .NET. Under the Projects tab of the Start Page, click New Project. In the Project Types window, highlight Visual Basic Projects. In the Templates window, highlight Windows Application. You may rename the project in the Name text field to whatever you like. Click Ok.
You should see a new Form appear. Along the left side of the window, there is a pop out menu labeled Toolbox. If the Toolbox menu is not there, click on View > Toolbox from the menu bar or press CTRL+ALT+X. Click the Toolbar menu and select Button. Draw a command button on the form.
Step 2: Add the appropriate references
In the Solution Explorer window, right-click References and click Add Reference. Alternately, you may use the Project > Add Reference menu.
At the top of the Add Reference window, click the COM tab. Highlight VISA COM 3.0 Type Library. Click Select to select the VISA COM 3.0 libraries and click OK.
Step 3: Connect to the instrument
Double-click on the command button in Design window or press F7 to view the skeleton code or your project. Enter the following code to connect to most IEEE 488.2 compliant instruments:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As _ System.EventArgs) Handles Button1.Click
Dim ioMgr As Ivi.Visa.Interop.ResourceManager Dim instrument As Ivi.Visa.Interop.FormattedIO488 Dim idn As String
ioMgr = New Ivi.Visa.Interop.ResourceManager instrument = New Ivi.Visa.Interop.FormattedIO488 ' use instrument specific address for Open() parameter – i.e. GPIB0::22 Set instrument.IO = ioMgr.Open("GPIB0::22")
instrument.WriteString("*IDN?") idn = instrument.ReadString() MsgBox("The IDN String is: " & idn, vbOKOnly, "IDN Result")
End Sub
To test your code, use the Debug > Start menu or press F5. Clicking the button should return the instrument address as a string in a message box.
For more information regarding available interfaces and classes, press CTRL+ALT+J or use the View > Other Windows > Object Browser menu.