VB编写循环程序
发布网友
发布时间:2022-09-19 04:23
我来回答
共1个回答
热心网友
时间:2023-10-25 08:38
添加两个Timer控件(Timer1和Timer2),再添加一个Label1,然后复制→粘贴,点击【是】,创建控件数组,也就变成4个Label了。
参考代码如下:
Dim
i
As
Integer,
k
As
Integer
Private
Sub
Command1_Click()
Timer2.Enabled
=
True
Timer1.Enabled
=
False
End
Sub
Private
Sub
Form_Load()
Timer1.Enabled
=
False
Timer2.Enabled
=
False
Timer1.Interval
=
600
Timer2.Interval
=
1000
End
Sub
Private
Sub
Timer1_Timer()
lblDisp(i).Caption
=
StrConv(i
+
1,
vbWide)
i
=
i
+
1
If
i
=
4
Then
Timer1.Enabled
=
False
End
Sub
Private
Sub
Timer2_Timer()
lblDisp(k).Caption
=
k
+
1
k
=
k
+
1
If
k
=
4
Then
Timer2.Enabled
=
False:
Timer1.Enabled
=
True
End
Sub