关于VB的时间问题

来源:百度知道 编辑:UC知道 时间:2024/06/14 10:05:04
怎样才能点击一个按钮,使Lable1=1,大约5秒后,Lable2=2,大约5秒后,Lable3=3
希望能有解释,我是新手

Private Sub Form_Load()
Timer1.Enabled = False
End Sub
Private Sub Command1_Click()
Label1.Caption = 1
Timer1.Interval = 5000 '设为每个5秒执行一次Timer事
Timer1.Enabled = True
End Sub
Private sub Timer1_Timer()
label1.caption=val(label1.caption)+1 'label1的值增加1
End Sub

添加Timer控件
Dim i As Integer
Private Sub Command1_Click()
Label1.Caption = 1
Timer1.Interval = 5000
Timer1.Enabled = True
End Sub

Private Sub Form_Load()
Timer1.Enabled = False
End Sub

Private Sub Timer1_Timer()
Label2.Caption = 2
i = i + 1
If i = 2 Then
Label3.Caption = 3
Timer1.Enabled = False
End If
End Sub