大家帮我看看一个简单的时间类,为什么不能显示?
Option Explicit
'类模块
Private mHour As Integer
Private mMinute As Integer
Private mSecond As Integer
Public Sub SetTime(ByVal h As Integer, ByVal m As Integer, ByVal s As Integer)
mHour = IIf((h >= 0 And h < 24), h, 0)
mMinute = IIf((m >= 0 And m < 60), m, 0)
mSecond = IIf((s >= 0 And s < 60), s, 0)
End Sub
Public Function ToFormatTime() As String '24小时制
ToFormatTime = Format$(mHour, "00") & ":" & Format$(mMinute, "00") & ":" & Format$(mSecond, "00")
End Function
Public Function ToStandardTime() As String '(12小时制)
Dim h As Integer
h = IIf((mHour = 12 Or mHour = 0), 12, mHour Mod 12)
ToStandardTime = h & ":" & Format$(mMinute, "00") & ":" & Format$(mSecond, "00") & " " & IIf(mHour < 12, "AM", "PM")
End Function
'form窗体里的代码
Option Explicit
Private Sub Form_Load()
Dim t As New CTime '调用类
Print "标准时间为:" & t.ToStandardTime()
Print "24小时制时间为:" & t.ToFormatTime()
Print
Call t.SetTime(17, 28, 46)
Print "标准时间为:" & t.ToStandardTime()
Print "24小时制时间为:" & t.ToFormatTime()
End Sub
运行后为什么窗体上什么都没显示?