Chapter 3 Programming Examples
RIGOL
DS4000E Programming Guide
3-13
Visual Basic 6.0 Programming Example
Program used in this example: Visual Basic 6.0
Function realized in this example: controlling the on/off status of any channel.
1.
Build a standard application program project (Standard EXE), and name it "Demo_VB".
2.
Click Project
Add Module to open the Add Module dialog box. In the dialog box, click the
Existing tab to search for the visa32.bas file in the "include" folder in the NI-VISA installation path
and add the file.
3.
In the Demo dialog box, add four buttons to represent CH1 to CH4 respectively. Add four Labels
(Label1(0), Label1(1), Label1(2) and Label1(3)) to represent the statuses of CH1 to CH4 respectively
(when the channel is enabled, it displays the color of the channel; when the channel is disabled, it
displays gray), as shown in the figure below.
4.
Click Project
Project1 Properties to open the Project1 – Project Properties dialog box.
Select Form1 in the Startup Object drop-down list box in the General tab.
5.
Double-click CH1 to enter the programming environment. Add the following codes to control CH1. The
codes of CH1 are as shown below; the codes of the other channels are similar. Please use the same
method to control the other channels.
Dim defrm As Long
Dim vi As Long
Dim strRes As String * 200
Dim list As Long
Dim nmatches As Long
Dim matches As String * 200