代码:
Private Sub Command1_Click()
Dim Year As Integer
Dim Month As Integer
Dim Day As Integer
Dim Birthday As Date
Dim N As Integer
Year = Int(Val(Text1.Text))
Month = Int(Val(Text2.Text))
Day = Int(Val(Text3.Text))
Birthday = DateSerial(Year, Month, Day)
N = Weekday(Birthday)
Label6.Caption = MyWeekdayName(N)
End Sub
Private Function MyWeekdayName(N As Integer) As String
Select Case N
Case 1
MyWeekdayName = "星期日"
Case 2
MyWeekdayName = "星期一"
Case 3
MyWeekdayName = "星期二"
Case 4
MyWeekdayName = "星期三"
Case 5
MyWeekdayName = "星期四"
Case 6
MyWeekdayName = "星期五"
Case 7
MyWeekdayName = "星期六"
End Select
End Function
心得体会:这次比较顺利通过老师的讲解,上机时自己便做出来了,以后一定要继续努力。