计算机学习心得

哈哈,老

Function myweekdayName(weekofday As Integer) As String

Select Case weekofday

    case1

    myweekdayName = "星期日"

    Case2

    myweekdayName = "星期一"

    case3

    myweekdayName = "星期二"

    case4

    myweekdayName = "星期三"

    case5

    myweekdayName = "星期四"

    case6

    myweekdayName = "星期五"

    case7

    myweekdayName = "星期六"

    End Select

   

    End Function

 

      

Private Sub Command1_Click()

Dim year As Integer

Dim month As Integer

Dim day As Integer

 

Dim weekofday As Byte

 

Dim Birthday As Date

 

year = Int(Val(Text1.Text))

month = Int(Val(Text2.Text))

day = Int(Val(Text3.Text))

 

Birthday = DateSerial(year, month, day)

weekofday = Weekday(Birthday)

 

Label7.Caption = WeekdayName(weekofday)

 

End Sub

师这节课讲的是如何编写一个程序来输出你的生日那天是星期几,哈哈,编写成功后输出我的生日是星期四,我是第一次关注这个,好玩啊!

你可能感兴趣的:(计算机学习心得)