?? time1.vb
字號:
Public Class time1
Private h As Integer
Private m As Integer
Private s As Integer
Public Sub New(ByVal myhour As Integer, ByVal myminute As Integer, ByVal mysecond As Integer)
Me.hour = myhour
Me.minute = myminute
Me.second = mysecond
End Sub
Public Sub New(ByVal myhour As Integer, ByVal myminute As Integer)
Me.hour = myhour
Me.minute = myminute
Me.second = 0
End Sub
Public Property hour() As Integer
Get
Return h
End Get
Set(ByVal Value As Integer)
If Value > 23 Or Value < 0 Then
MessageBox.Show("小時必須在 0~23!")
Else : h = Value
End If
End Set
End Property
Public Property minute() As Integer
Get
Return m
End Get
Set(ByVal Value As Integer)
If Value > 59 Or Value < 0 Then
MessageBox.Show("分鐘必須在 0~59!")
Else : m = Value
End If
End Set
End Property
Public Property second() As Integer
Get
Return s
End Get
Set(ByVal Value As Integer)
If Value > 59 Or Value < 0 Then
MessageBox.Show("秒必須在 0~59!")
Else : s = Value
End If
End Set
End Property
Public Function touniversalstring() As String
Dim a As String
If h < 10 Then
a = "0" & hour() & ":"
Else : a = hour() & ":"
End If
If m < 10 Then
a = a & "0" & minute & ":"
Else : a = a & minute & ":"
End If
If s < 10 Then
a = a & "0" & second
Else : a = a & second
End If
Return a
End Function
End Class
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -