编写将出生日期转换为周几的程序
通过编写这个程序我不仅知道自己是周几出生的,更重要的是我学到了vb知识,感觉挺有意思的,虽然编写过程挺难理解的,但我会一点点慢慢学习的。
下面是编写过程:
Dim Year as Integer
Dim Month as Integer
Dim Day as Integer
Dim Dayofweek 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)
Dayofweek=Weekday(Birthday)
Label6.caption=Weekdayname(n)
End sub
Private Function Myweekdayname(Dayofweek as integer)as string
select case n
case 1
Myweekdayname=“星期天”
case 2
Myweekdayname="非星期天"
End select
End Function
通过对这个编程的编写我发现我对vb理解的太肤浅,需要认真的揣摩其中的细节,我要谨小慎微从小细节做起,是自己更好的应用这门学科。