1.��ʱvbԴ��
2.VB timer控制显示当前时间 并自动刷新,定时定我写的源码api源码解读哪错了
��ʱvbԴ��
1)
启动visual basic6.0 ,打开一个新的定时定ci个性指标源码标准工程。
2)
在窗体上Form1上添加6个标签空间(Label) 2个命令按钮(CommandButton)和1个计时器(Timer)。源码BT搜索源码下载命令按钮的定时定罗源码头气象Caption属性分别为“启动”“停止”
Timer1的Interval属性为
Label1 Label2 Label3的Caption属性分别为“开始时间”“结束时间”“经过时间” Timer1的Enable属性为False
3)代码
Dim Starttime As Variant
Dim End time As Variant
Dim Elapsed As Variant
Private Sub cmdStart_Click()
'显示开始时间
lblStart.Caption=Time$
Starttime=Now
'启动时钟控件
Timer1.Enabled=Ture
End Sub
Private Sub cmdStop_Click()
'记录停止时间
Endtime=Now
'关闭时钟控件
Timer1.Enabled=False
'显示经过时间
lblApaed.Caption=Format(Endtime-Starttime,"hh:mm:ss"
End Sub
Private Sub Timer1_Timer()
lblStop.Caption=Time$
End Sub
以上是用VB6.0实现的
VB timer控制显示当前时间 并自动刷新,我写的源码ss账号源码哪错了
Private Sub Form_Load()
Timer1.Interval = '这个改成 有一定缓冲时间
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Dim timey, timem, timed, timeh, timemi, i As String
Dim tim As Integer
timey = CStr(Year(Now))
timem = CStr(Month(Now))
timed = CStr(Day(Now))
timeh = CStr(Hour(Now))
timemi = CStr(Minute(Now))
If Val(timeh) > Then
i = "PM"
tim = Val(timeh) -
Else
i = "AM"
End If
Label1.Caption = "现在的时间是:" & timey & "年" & timem & "月" & timed & "日" & i & (CStr(tim)) & "时" & timemi & "分"
End Sub
另外帖上一个源代码供你参考
============================================
Private Sub Form_Load()
Me.Caption = Year(Date) & "年" & Month(Date) & "月" & Day(Date) & "日 星期" & GetWD(Weekday(Date)) & " 系统时间" & Format$(Time, "hh:mm:ss")
Timer1.Interval =
End Sub
'xx年xx月xx日 星期几 系统时间hh:mm:ss
Private Sub Timer1_Timer()
Me.Caption = Year(Date) & "年" & Month(Date) & "月" & Day(Date) & "日 星期" & GetWD(Weekday(Date)) & " 系统时间" & Format$(Time, "hh:mm:ss")
'"xx年xx月xx日 星期几 系统时间hh:mm:ss"
End Sub
Function GetWD(ByVal Week As Integer) As String
Select Case Week
Case 1
GetWD = "日"
Case 2
GetWD = "一"
Case 3
GetWD = "二"
Case 4
GetWD = "三"
Case 5
GetWD = "四"
Case 6
GetWD = "五"
Case 7
GetWD = "六"
End Select
End Function
2024-12-27 19:03
2024-12-27 18:02
2024-12-27 17:26
2024-12-27 17:07
2024-12-27 16:59
2024-12-27 16:34