VB如何在单击窗体时在各TEXT中显示当前时间.
运行时.显示当前的年月日星期及时间.(分别显示在不同的TEXT中)下面是我做的.但是不知道哪里错了或漏了.没有分..希望好心人指教..PrivateSubText1_Ch...
运行时.显示当前的年月日星期及时间.(分别显示在不同的TEXT中)
下面是我做的.但是不知道哪里错了或漏了.没有分..希望好心人指教..
Private Sub Text1_Change()
Me.Caption = Year(Date)
End Sub
Private Sub Text2_Change()
Me.Caption = Month(Date)
End Sub
Private Sub Text3_Change()
Me.Caption = Day(Date)
End Sub
Private Sub Text4_Change()
Me.Caption = GetWD(Weekday(Date))
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
Private Sub Text5_Change()
Me.Caption = Format$(Time, "hh:mm:ss")
End Sub 展开
下面是我做的.但是不知道哪里错了或漏了.没有分..希望好心人指教..
Private Sub Text1_Change()
Me.Caption = Year(Date)
End Sub
Private Sub Text2_Change()
Me.Caption = Month(Date)
End Sub
Private Sub Text3_Change()
Me.Caption = Day(Date)
End Sub
Private Sub Text4_Change()
Me.Caption = GetWD(Weekday(Date))
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
Private Sub Text5_Change()
Me.Caption = Format$(Time, "hh:mm:ss")
End Sub 展开
展开全部
Private Sub Form_Click()
Text1.Text = Year(Date)
Text2.Text = Month(Date)
Text3.Text = Day(Date)
Text4.Text = "星期" & GetWD(Weekday(Date))
Text5.Text = Format$(Time, "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
搞定了
Text1.Text = Year(Date)
Text2.Text = Month(Date)
Text3.Text = Day(Date)
Text4.Text = "星期" & GetWD(Weekday(Date))
Text5.Text = Format$(Time, "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
搞定了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询