vb.net秒表计时器的简单介绍

用VB.net做一个时间计时器

'添加一个label标签名字label1 用来显示时间

创新互联公司是一家专注于网站设计制作、网站设计与策划设计,沧州网站建设哪家好?创新互联公司做网站,专注于网站建设10年,网设计领域的专业建站公司;建站业务涵盖:沧州等地区。沧州做网站价格咨询:18982081108

'再添加一个timer控件 名字timer1 interval属性=1000 用来计时

'窗体添加代码

Dim t As Date '用来记录时间

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As _

System.EventArgs) Handles Timer1.Tick

t = t.AddSeconds(1)

Label1.Text = "登录时间:" t.TimeOfDay.ToString

End Sub

vb.net 我想编一个计时器,计时器显示格式00:00:00 (只能用一个label)怎么做?

Dim hour, min, sec As Integer

Private Sub Command1_Click()

If Command1.Caption = "开始计时" Then

Command1.Caption = "停止计时"

Timer1.Enabled = True

Else

If Command1.Caption = "停止计时" Then

Command1.Caption = "开始计时"

Timer1.Enabled = False

End If

End If

End Sub

Private Sub Form_Load()

hour = 0

min = 0

sec = 0

Label1.Caption = Format(hour, "00") ":" Format(min, "00") ":" Format(sec, "00")

End Sub

Private Sub Timer1_Timer()

sec = sec + 1

If sec 59 Then

sec = 0

min = min + 1

If min 59 Then

min = 0

hour = hour + 1

End If

End If

Label1.Caption = ""

Label1.Caption = Format(hour, "00") ":" Format(min, "00") ":" Format(sec, "00")

End Sub

VB.NET 计时器的问题

不对。步骤如下:

添加一个label标签名字label1 用来显示时间

再添加一个timer控件 名字timer1 interval属性=1000 用来计时

窗体添加代码

Dim t As Date '用来记录时间

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As _

System.EventArgs) Handles Timer1.Tick

t = t.AddSeconds(1)

Label1.Text = "登录时间:" t.TimeOfDay.ToString

End Sub


本文题目:vb.net秒表计时器的简单介绍
网站路径:http://myzitong.com/article/doidgjo.html