十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
加一个计时器控件Timer1
创新互联服务项目包括岗巴网站建设、岗巴网站制作、岗巴网页制作以及岗巴网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,岗巴网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到岗巴省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!
代码如下:
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Timer1.Interval = 15000
Timer1.Start()
MessageBox.Show("程序将在15s后关闭.")
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Me.Dispose()
End Sub
用Timer控件吧,设置1秒执行1次。然后直接在Timer中写代码,将全全局的值来
减减1,如果值为0,则停止Timer
跳出提示框
以下示例:
int
Tatal
=
100;
Timer.Inveral
=
1000;
Timer_()
{
if
(
Tatal
==
0)
{
MessageBox.Show("完成!");
Timer.Stop();
}
else
{
Tatal
--;
}
}
画面添加textbox1 timer1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Interval = 1000
TextBox1.Text = "2011/12/07 10:35:00"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If IsDate(TextBox1.Text) = True Then
Timer1.Start()
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If Format(Now, "yyyy/MM/dd hh:mm:ss") = TextBox1.Text Then
MsgBox("It's time to go")
Timer1.Stop()
End If
End Sub