timer 问题

来源:百度知道 编辑:UC知道 时间:2024/05/28 16:17:06
这样使按一个按钮后 过5秒才执行动作
好像是用timer 但小弟不知道这么样才行
比如 按command1 按钮 后五秒 执行 text1.text=""
谢谢大家

static i as integer
private sub command1_click()
timer1.enable=true
end sub
Private Sub Timer1_Timer()
i=i+1
if i=5 then
text1.Text = ""
end if
End Sub

将timer的intervel属性设为5000,Enabled属性设为false.
在按钮的click事件下写下:timer1.enabled=true

Private Sub Command1_Click()
Timer1.Enabled = True

End Sub

Private Sub Form_Load()
Timer1.Interval = 500
Timer1.Enabled = False

End Sub

Private Sub Timer1_Timer()
text1.Text = ""

End Sub

他说的是5秒啊,二楼的把:Timer1.Interval = 5000就可以啦!!

Private Sub Command1_Click()
Timer1.Interval = 5000
End Sub

Private Sub Timer1_Timer()
text1.Text = ""
End Sub

在运行前Timer1.Interval 设为0