包含vb.net如何倒计时的词条
vb.net怎么倒计时关闭窗口 就是我要它 还有15秒关闭form1 怎么能加什么控件吗?
加一个计时器控件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
求高手用vb.net做一个倒计时程序。
画面添加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
VB.net中如何用timer控件编出一个简单的倒计时器?
Dim tCount As Integer '用来计数
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
tCount = 10
Timer1.Interval = 1000 '每秒执行一次
Timer1.Enabled = True
End
Sub
Private Sub
Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
tCount -= 1
If tCount = 0 Then
MessageBox.Show("时间到")
Timer1.Enabled = False
End If
End
Sub
VB中如何timer 控件进行倒计时
1、程序加载时操作: Private Sub Form_Load() '窗体加载时自动进行
Timer1.Interval = 1000 ‘设置计时周期为1秒注意默认计时单位为毫秒,即1/1000秒
2、定义一个时间变量。可以某控件的Caption属性代替,如Label12.Caption
3、拖放timer控件到程序界面上
4、设置倒计时:双击时钟控件,输入计时规则,如Label12.Caption = Label12.Caption + 1
5、设置当时间值达到某一条件的时候应采取的方法(即动作)。可以用if语句。如if Label12.Caption =60,then Unload Form1,注意块if语句与行if语句的区别
以下是例子:
Private Sub Form_Load() '窗体加载时自动进行以下操作
Timer1.Interval = 1000 '计时频率设为1秒
end sub
Private Sub Timer1_Timer()
Label12.Caption = Label12.Caption - 1 '以秒计时
End Sub
Private Sub CommandSure_Click()
if Label12.Caption =
s = MsgBox("确认提交,取消重填!", 1, "提示信息") '弹出对话框
If s = 1 Then
f = MsgBox("提交信息成功,请点击确认退出系统", 0, "")
Unload Form1 '窗体关闭
Else
Load Form1 '重新初始化
Form1.Enabled = True '允许重填
Timer1.Enabled = True '继续计时
CommandSure.Enabled = True '确定按钮可用
end if
end sub
当前标题:包含vb.net如何倒计时的词条
标题链接:http://scjbc.cn/article/dodohsi.html