Option Explicit
Dim WithEvents tim As Timer
Private Sub Command1_Click()
tim.Enabled = True
End Sub
Private Sub Form_Load()
Dim temp$
Set tim = Controls.Add("vb.timer", "tim")
tim.Interval = 500: tim.Enabled = False
End Sub
Private Sub tim_Timer()
temp = Text1 & "-" & Text2 & "-" & Text3: Date = temp
temp = Text4 & ":" & Text5 & ":" & Text5: Time = temp
End Sub
Declare Function SetSystemTime Lib "kernel32" Alias "SetSystemTime" (lpSystemTime As SYSTEMTIME) As Long
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Dim time As SYSTEMTIME
'按键动作的,自己对应下时间吧,记得赋值
With time
.wYear = '年
.wMonth = '月
.wDay = '日
.wHour = '时
.wMinute = '分
.wSecond = '秒
End With
SetSystemTime time
上次不是给你发过一次代码了嘛
已经很清楚了哦,只要再简单的改一下就可以用了啊
真是败给你了,我再给你改一下吧
源码如下:
添加一个timer
Private Sub Form_Load()
Timer1.Interval = 500
End Sub
Private Sub Timer1_Timer()
Date = text1 & "-" & text2 & "-" & text3
Time = text4 & ":" & text5 & ":" & text6
End Sub
你的这个 输入 年月日时分秒 是什么意思?说明白点 我给你做!!!!