VB中按钮经过10秒之后才能关闭窗口,代码怎么写?
1个回答
2011-01-06
展开全部
窗体中加入一个command和一个timer控件,把下列代码拷贝到窗体代码中
Option Explicit
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 10000
End Sub
Private Sub Timer1_Timer()
Unload Me
End Sub
Option Explicit
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 10000
End Sub
Private Sub Timer1_Timer()
Unload Me
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询