虽然已经结贴了,还是写个电子时钟的代码,供参考吧。
在窗体上放两个 Label 控件和一个 Timer 控件
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Timer1.Enabled = True
Timer1.Start()
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label1.Text = DateAndTime.DateString
Label2.Text = DateAndTime.TimeString
End Sub