Visual basic programming demo, Visual basic programming demo -12 – RIGOL DSG3000 Series User Manual

Page 168

Advertising
background image

RIGOL

Chapter 4 Programming Demos

4-12

DSG3000 Programming Guide

Visual Basic Programming Demo

The program used in this demo: Visual Basic 6.0

The functions realized in this demo: turn on the LF, MOD and RF output switches respectively and use

yellow label to indicate that the output is turned on.

1. Build a standard application program project (Standard EXE) and name it as DSG3000_Demo_VB.

2. Click the Existing tab under Project Add Module. Find the visa32.bas file under the include

folder in the installation directory of NI-VISA and add the file.

3. Add three CommandButton controls to represent LF, MOD and RF respectively. Add three Label

controls (Label1(0), Label1(1) and Label1(2)) to denote the status of the three switches respectively

(the controls are gray by default and are yellow when the output switches are turned on). The layout is

as shown in the figure below.

4. Open the General tab under Project Project1 Properties and select Form1 from the Startup

Object dropdown box.

5. Double-clcik the LF button to enter the programming environment and add the following codes to

realize the control of LF, MOD and RF. The codes of LF are as shown below. The codes of MOD and RF

are similar.

Dim defrm As Long

Dim vi As Long

Dim strRes As String * 20

Advertising