Option Explicit Dim flag As Boolean Private Sub Command1_Click() If flag Then Timer1.Enabled = False Command1.Caption = "Open" Else Timer1.Enabled = True Command1.Caption = "Close" End If flag = Not flag End SubPrivate Sub Form_Load() Timer1.Interval = 50 Timer1.Enabled = False Command1.Caption = "Open" End SubPrivate Sub Timer1_Timer() Dim MyValue Randomize ' 对随机数生成器做初始化的动作。 MyValue = Int(1000000 * (Rnd) + 1) Text1(0) = Mid(MyValue, 1, 1) Text1(1) = Mid(MyValue, 2, 1) Text1(2) = Mid(MyValue, 3, 1) Text1(3) = Mid(MyValue, 4, 1) Text1(4) = Mid(MyValue, 5, 1) Text1(5) = Mid(MyValue, 6, 1) End Sub
Dim flag As Boolean
Private Sub Command1_Click()
If flag Then
Timer1.Enabled = False
Command1.Caption = "Open"
Else
Timer1.Enabled = True
Command1.Caption = "Close"
End If
flag = Not flag
End SubPrivate Sub Form_Load()
Timer1.Interval = 50
Timer1.Enabled = False
Command1.Caption = "Open"
End SubPrivate Sub Timer1_Timer()
Dim MyValue
Randomize ' 对随机数生成器做初始化的动作。
MyValue = Int(1000000 * (Rnd) + 1)
Text1(0) = Mid(MyValue, 1, 1)
Text1(1) = Mid(MyValue, 2, 1)
Text1(2) = Mid(MyValue, 3, 1)
Text1(3) = Mid(MyValue, 4, 1)
Text1(4) = Mid(MyValue, 5, 1)
Text1(5) = Mid(MyValue, 6, 1)
End Sub
Randomize (1)
Text1(0) = Int((9 * Rnd) + 1)
Text1(1) = Int((9 * Rnd) + 1)
Text1(2) = Int((9 * Rnd) + 1)
Text1(3) = Int((9 * Rnd) + 1)
Text1(4) = Int((9 * Rnd) + 1)
Text1(5) = Int((9 * Rnd) + 1)
End Sub