vb 如何获取动态系统时间,像电子时钟一样
发布网友
发布时间:2023-12-24 22:08
我来回答
共2个回答
热心网友
时间:2024-12-15 04:59
该代码需
2个Timer控件tmrtime和tmrdate
2个按钮控件cmdtime和cmddate
1个文本框控件txtdisplay
你的代码有错,修改如下:
Private Sub Form_Load()
tmrtime.Interval = 1000
tmrdate.Interval = 1000
End Sub
Private Sub tmrtime_Timer()
txtdisplay.Text = Time
End Sub
Private Sub cmddate_Click()
txtdisplay.Text = ""
tmrdate.Enabled = True
tmrtime.Enabled = False
End Sub
Private Sub cmdtime_Click()
txtdisplay.Text = ""
tmrtime.Enabled = True
tmrdate.Enabled = False
End Sub
Private Sub tmrdate_Timer()
txtdisplay.Text = Date
End Sub
热心网友
时间:2024-12-15 05:00
Option Explicit
'需要一个timer
Private Sub Form_Load()
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
Me.Cls
Me.Print Now
End Sub