程序简要介绍:
新建一个窗体,在该窗体内放入9个标签控件,其中label2--label8分别放入选出的号码;有一个组合框控件,准备存入每次选中的号码;两个命令按钮,分别为“开始选号”与“退出”。
代码如下:
Option Explicit
Private Sub
Command1_Click() '开始选号
Dim q As Integer
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim d As Integer
Dim e As Integer
Dim f As Integer
Dim g As Integer
For q = 1 To 7
Select Case q
Case 1
Randomize (Time)
a = Int(Rnd * 33 + 1)
Label2.Caption = a
Case 2
Do
Randomize (Time)
b = Int(Rnd * 33 + 1)
Loop Until b <> Label2.Caption
Label3.Caption = b
Case 3
Do
Randomize (Time)
c = Int(Rnd * 33 + 1)
Loop Until c <> Label2.Caption And c
<> Label3.Caption
|